You need to obtain the current timestamp prior to entering the loop and save
it into a  JMeter Variable
<https://jmeter.apache.org/usermanual/functions.html>  .  It can be done
using the following  __groovy() function
<https://jmeter.apache.org/usermanual/functions.html#__groovy>  
> ${__groovy(vars.putObject('start'\, System.currentTimeMillis()),)}

Now you have loop start time hence you can introduce 2  clauses for the
while loop, it can be done using the aforementioned __groovy() function
which needs to be put into the  While Controller's
<https://jmeter.apache.org/usermanual/component_reference.html#While_Controller>
  
"Condition" input field:
> ${__groovy((vars.get('callAPIVariable').equals('true') &&
> (System.currentTimeMillis() - (vars.getObject('start') as long) <
> 30000)),)}

Assuming the above setup the While Controller will loop over until
*callAPIVariable* value is *true* or 30 seconds pass, whatever happens the
first. See  The Groovy Templates Cheat Sheet for JMeter
<https://www.blazemeter.com/blog/the-groovy-templates-cheat-sheet-for-jmeter/>  
article to learn what else can be done using Groovy scripting in JMeter
tests. 



--
Sent from: http://www.jmeter-archive.org/JMeter-User-f512775.html

Reply via email to