2

I am using JMeter to run a performance test. One of the "rest" requests keeps failing ever other request so I added a while controller to handle this issue:

${__javaScript(("${success}".indexOf("token_expiration_date") == -1 && ${Auth_2} < 3),)}

I captured part of the success response with a Regular Expression and added a counter so the while controller will run only 2 times for the same request.

Auth_2 --> Counter Reference name ..... success --> Regular Expression ..... token_expiration_date --> part of success response

My script runs fine if I get a success response, but otherwise, the loop will exit after the second request as defined in the counter and start over again in an endless loop. Below is part of the test result in the latter case.

Why is my loop restarting after the second request?

enter image description here

enter image description here

1 Answer 1

1

Most likely your Counter configuration is not correct, looking into the screenshot I fail to see ${Auth_2} above 2 so second part of your While Controller expression will never be true

So make sure your Counter configuration looks like:

JMeter Counter Configuration

and your test should start working as expected. See How to Use a Counter in a JMeter Test article to learn more about generating incremented values in JMeter test using Counter configuration element and function.

1
  • Thanks for your response, my counter is set exactly as you showed.
    – user25344
    Apr 24, 2017 at 13:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.