jsonjmeterjson-extractpost-processor

how to get the values from json extracted variables?


i am testing on a api and the url link for that api is : https://petstore.swagger.io/v2/pet/findByStatus?status=available

and it returns us a json response and json response varies every time the test runs. by using the json extractor i have extracted the json values using json extractor the configuration of json extractor looks like this: json extractor config

now i want to get the 78th value and 110th value from the extracted values but when i run the test sometimes it is giving me 70 results sometimes it gives me 100

how to get the values based on my requirement..?

this is to be test the api

thanks in advance for the help


Solution

  • If the response "varies" and there are only 70 entries in the returned JSON you won't be able to get 78th and 110th items.

    You might want to use Filter Operators and get the response data according to additional criteria, not only blindly getting all the IDs.

    See JMeter's JSON Path Extractor Plugin - Advanced Usage Scenarios article for more details.

    If the response is static and you need 78th ID just set the corresponding Match No in the JSON Extractor

    enter image description here