Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jmeter and Json, extracting and using variables for another request

I'm new to JMeter and I'm probably missing something quite simple...

Note: I'm using a json add-on as well.

After making a request, I extract a value from the response. If I check the view results I'm able to see the correct value in the variable I created.

-Initial extraction of value- My Initial response

-how I tried to use my new value for a new request- My Second Request Using the Variable

If I try use the variable in another request, I receive an error because the variable is now the default value.

Default value being used for variable

What am I doing incorrectly that makes the second post request to use the default value and not the value it captured (if I did that correctly).

Thanks

like image 879
user3531858 Avatar asked Apr 17 '26 06:04

user3531858


1 Answers

JSON Path Extractor is a Post Processor. It is not a Sampler. It should be the child element of the first request 'Create Order' in your test plan if you are going to extract from the 'Create Order' response. If it is in same level with other requests, the post processor will be executed for each and every samplers in the same level. That is why, You are able to see the value for the first time. Now Post processor tries to extract the value from the Debug Sampler as well. As Debug Sampler does not match your JSON extract condition, It sets the default value.

like image 111
vins Avatar answered Apr 20 '26 07:04

vins



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!