0
votes

I have an http request sampler1 and extracting a 'JobID' value using regular expression extractor. Now, i have http request sampler2 to check a job status in the same thread group which uses 'JobID' from previous sampler using regular expression extractor. The sampler2 has a while loop controller with condition ${__javaScript("${Status}"!="Ready",)} which is to say keep executing the sampler until status is Ready.

The issue that i am facing is, when the first sampler fails, the second sampler just takes the variable name and keeps trying and never stops because of the while loop.

the second sampler http request gets formed like:

JobID=%24%JobID%7D&request=****

Is there a way to say stop executing the second sampler when first one fails. Any input on this would be of great help.

1

1 Answers

0
votes

This is how JMeter works, each thread (virtual user) executes Samplers upside down (or according to the Logic Controllers)

If you want want to execute 2nd sampler only if first one is successful you need to put your While Controller along with the 2nd sampler under the If Controller and use ${JMeterThread.last_sample_ok} as the condition

enter image description here

Where ${JMeterThread.last_sample_ok} is a pre-defined variable holding the result of the previous Sampler