Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Difference between Start Next Thread Loop and Stop Thread in JMeter

There is a Test plan in with set of related requests. If first request fails then I need skip subsequent request as they will anyways fail. How can I achieve this in JMeter.
Test Plan
ThreadGroup(Number of threads:2)
Request1
Request2
Request3
Request4

For example: If Request1 fails due to some error then thread should not execute Request2, Request3, Request4. as Request2,3 & 4 use token from request1 and it will anyways fail if request fails. Can it be achieved using Start Next Thread Loop and Stop Thread. what is the different between these two options

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Each JMeter thread (virtual user) you define in the Thread Group executes Samplers upside down.

When there are no more Samplers to execute or loops to iterate – the thread is being shut down. When there are no more running threads – the test will fail.

  • Start Next Thread Loop – ignore the error, start next loop and continue with the test, so if Request1 fails – JMeter will simply go to the next iteration of the Thread Group and will try to execute Request 1 one more time until it will be successful. The failure will be recorded in the .jtl results file
  • Stop Thread – current thread exits, it means that the current thread will be shut down and won’t execute anything. The failure will be recorded in the .jtl results file

Another option is use If Controller with ${JMeterThread.last_sample_ok} pre-defined variable as the condition, if you design your test plan like this:

enter image description here

the Request2 will only be executed only if Request1 is successful

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading