Ashley
Ashley

Reputation: 157

Multiple conditions in while controller

Is it possible to add two conditions in while controller? My two conditions are Complete ="True" and Results >200.

I tried using it by setting Complete = False and Results=0 in user defined variables and used it in while controller as follows:

${__javaScript("${Complete}" != "true")} && ${__javaScript((parseInt(${Results}) >90)}.

But it is looping indefinitely. Please help.

Upvotes: 3

Views: 8730

Answers (2)

Muhammad Atif Niaz
Muhammad Atif Niaz

Reputation: 23

For Multiple Condition in While Loop using Groovey Function for '&&' and '||' for the same field.

${__groovy(!(vars.get('ocrstatus_1').equals('500') || vars.get('ocrstatus_1').equals('1000')) ,)}

Upvotes: 0

Naveen Kumar R B
Naveen Kumar R B

Reputation: 6398

Try the following condition (working for me):

${__jexl3("${Complete}" == "False" && ${Results} >= 0,)}

where Complete - False & Results - 0.

For above values, condition will be evaluated to true, hence executes the children of the While Controller.

Note: Please change the conditions == & >= symbols and values False && 0 as per your requirements.

You must reset the values inside the While Controller, to make the condition evaluated to false, otherwise you will struck in infinite loop.

References:

  1. https://jmeter.apache.org/usermanual/component_reference.html#While_Controller
  2. https://www.blazemeter.com/blog/using-while-controller-jmeter

Upvotes: 3

Related Questions