Harry S
Harry S

Reputation: 73

Jmeter : While Controller : Loop not getting executed for second itreration

I am working on simple JMeter script and using WHILE controller. When i run the test for one user and one iteration the while controller executes well.

when i run the test for one user and two (more than 1) iteration, the control does not go inside while controller

for eg 1 user and 3 iteration

Iteration 1 : while controller will be executed : Iteration will Pass
Iteration 2 : while controller will be executed : Iteration will Fail
Iteration 3 : while controller will be executed : Iteration will Fail

Thanks in advance.

Upvotes: 2

Views: 1357

Answers (1)

Dmitri T
Dmitri T

Reputation: 168197

My expectation is that you need to reset your ${file_status} variable value at the beginning of the 2nd iteration, not knowing the details of your Test Plan I can suggest only doing it via JSR223 Test Element, the code will be as simple as:

vars.put("file_status", "something not equal to UNPUBLISHED")

vars is a shorthand to JMeterVariables class instance, it provides read/write access to all JMeter Variables in scope, the above code will set ${file_status} variable value to something different from UNPUBLISHED so on 2nd and further iterations your While Controller will be executed as well.

See Groovy Is the New Black article for more information on using Groovy scripting in JMeter tests.

Upvotes: 3

Related Questions