0
votes

Im running a test plan containing 10 requests i need to get the variable value from 3rd response json to be passed to request URL of 10 th request passed . any way we can use json extractor to do this?

2

2 Answers

1
votes

This can be accomplished by using any of the post processors for correlation in amongst any of the requests. I have shown an example below with JSON Extractor

Request Sample

The value that I am going to extract from 3rd request's response is "I am the value to be fetched from 3rd response"

enter image description here

JSON Extractor

I am using the below syntax in JSON Path Expression to extract data from "valueToBeFetched" json object and storing it in variable named "extractedValue_C"

$..valueToBeFetched

enter image description here

10th Request

Replacing the extracted value with syntax ${extractedValue_C} in 10th request

enter image description here

Output

Response Captured from 3rd Response

enter image description here

Captured value passed in 10th request

enter image description here

Hope this helps!

0
votes

JSON Extractor obeys JMeter Scoping Rules so if you put it as a child of the 3rd request - it will be applied to 3rd request only.

If you come up with a valid JSONPath matching the value you want to extract - the value will be saved into a JMeter Variable which can be used anywhere after 3rd request (where it is defined or overwritten in next iteration)