vendredi 30 novembre 2018

JMeter pass JSON response value to next request

I am using JMETER to test a web app.

First I perform a http GET request which returns a JSON array such as:

[
  {
    "key1": 
    {
      "subKey": 
      [
        9.120968,
        39.255417
      ]
    },
    key2 : 1

  },
  {
    "key1": 
    {
      "subKey": 
      [
        9.123852,
        39.243237
      ]
    },
    key2 : 10
  }

]

Basically I want to take randomly one element, take the elements of key1 and create 2 variables in JMeter that will be used for the next query (if randomly it is not possible than just the 1st element).

I tried using JSON Extractor with the following settings:

enter image description here

and in the next query referencing the parameter as ${var1}.

How to set JSON Extractor to extract a value, save into a JMeter variable to be used in the next query?

Aucun commentaire:

Enregistrer un commentaire