Reputation: 1
How can I pass 2 condition in a while loop on Jmeter. The conditions are
Condition 1 is working fine. However condition 2 is unable to implement.
I have tried running the While Loop inside a Runtime Controller. But the issue is, if the response "Pass" comes before 1 min, the rest of the test stops. Tried other way round (Runtime inside While Loop) leading to numerous execution of the request, even after receiving "Pass" response.
Will appreciate any leads on this. Thanks
Upvotes: 0
Views: 1659
Reputation: 1821
This could be another solution.
You can achieve the desired outcome with the following components.
Upvotes: 0
Reputation: 168092
Add a JSR223 Sampler just before the While Controller and store the current time into a JMeter Variable using the following code:
SampleResult.setIgnore()
vars.putObject('whileLoopStart', System.currentTimeMillis())
Use the following __groovy() function as the While Controller's condition:
${__groovy(!vars.get('your_variable').equals('Pass') && ((System.currentTimeMillis() - vars.getObject('whileLoopStart')) < 60000),)}
This way the While Controller will run until:
your_variable
is not equal to Pass
More information on Groovy scripting in JMeter: Apache Groovy - Why and How You Should Use It
Upvotes: 1