Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jMeter calling a request again after an error

When running a load test invariable problems occur, any HTTP request might time out or the server may return a custom error page. I have a lovely jMeter script that runs without expecting any errors to occur, which is what happens under low usage.

How do I modify this script so that if an error occurs the script reruns the request that caused the error until it does not get an error? For example I have a login request that if fails I don't want to carry on, I want to keep trying until the login works. I also don't want to start the script again as I don't want to login again if a page fails after login.

I have looked at the "Continue with next loop" in the thread group but I can not find out what that actually does, Does it start the test over? Does it jump to the next loop logic controller? Do I have to surround all my requests with loops?

Thanks Paul

like image 216
Paul Barclay Avatar asked May 29 '12 09:05

Paul Barclay


1 Answers

Continue with next loop will restart the entire thread group in the event that any one of the samplers returns false.

As for retrying a request you can achieve this using a While Controller. If you have a Regular Expression Extractor looking for a value that will only appear upon success - like "Login Successfull" and then tell the While Controller to loop while myvar != "some text" you will achieve what you want. You obviously want to use a timer inside this loop.

But really, if your AUT is exhibiting errors under the load you're probably better of expending effort fixing the Application, not the Test. It's perfectly valid to have a test run with lots of errors if they are real, genuine application errors - you absolutely don't want to mask them.

like image 63
Oliver Lloyd Avatar answered Sep 28 '22 08:09

Oliver Lloyd