Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Variable is only set by JSON Post Processor with Debug Sampler enabled

Tags:

json

jmeter

I definitely feel like I am missing something obvious, but here it goes anyway. I have a script that does the following per user in a thread group:

login get a json list for that user extract a part of the list from the response with a regex extractor into a variable called feed start a for loop with feed_matchNr number of iterations start a Counter get the nth item from the list and use JSON Post Processor on the feed variable to get an id make an additional http request with that id continue loop

enter image description here

This all works as expected ... until I disable the Debug Sampler. Then the http request no longer "expands" the variable, instead the request has something like /api/path/${myid}/foo and fails. What black magic is the Debug Sampler doing and how can I do the same magic without it?

like image 818
Philip Nelson Avatar asked Jun 03 '26 06:06

Philip Nelson


1 Answers

Your issue is the following:

  • First understand that Post Processor only runs IF the is a Sampler in its scope:

    • http://jmeter.apache.org/usermanual/component_reference.html#postprocessors
  • So in you plan, when you put a Debug Sampler , it runs. If you disable it, it only runs for post comment, so it has not initialized the variable for post comment.

Also is there a reason to put -1 in JSON Post Processor, this means you want to get all values:

  • http://jmeter.apache.org/usermanual/component_reference.html#JSON_Path_PostProcessor
like image 75
UBIK LOAD PACK Avatar answered Jun 05 '26 19:06

UBIK LOAD PACK