1

We have an option in ThreadGroup to stop or continue threads in case of errors. But this option applies to all the samplers within ThreadGroup.

Is there any way by which we can apply this condition only to specific samplers. For example, I have Login samplers in my test Plan and I want to stop those threads only which fail for login samplers.

Any possible workaround for that in JMeter!

3

Add Beanshell PostProcessor as a child of the request which must be successful and put the following code into "Script" area:

if (!prev.isSuccessful()) {
     prev.setStopThread(true);
}

where prev stands for associated parent SampleResult

See How to Use BeanShell: JMeter's Favorite Built-in Component guide for more information on using Beanshell in your JMeter tests

  • I had used an alternative approach that involved JMeter "Test Action". But your solution is much simpler and works great. thanks. – TestingWithArif Feb 8 '16 at 13:17
  • 1
    Am I guessing right that @Dmitri T is the main developer of Jmeter tool? :-) – Tired Of Testing Nov 10 '17 at 15:33
3

If you need to limit this behavior to one request, add a Result Status Action Handler as a child of the request

enter image description here

It's in post processor, then if it fails you can configure what happens, e.g. Stop the Thread from carrying on.

enter image description here

  • Could you provide an example of this in use? – Swagin9 Nov 9 '17 at 20:26
  • I have updated my answer to include a screenshot – Joseph Moore Nov 10 '17 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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