I want to implement error handling in my script (like textcheck in LR).
I’m able to validate the Text using Response Assertion.
But my question is how to stop the thread if the Response Assertion (text check) fails.
JMeter does not provide a way for stopping thread to execute a "shutdown sequence", they have tearDown Thread group instead. You should use it in your case.
Response Code: JMeter checks and validates the response code only like 200, 302 etc. Response Message: JMeter checks and validates the response message only like OK, Error etc. Document (text): This option allows JMeter to search the pattern string in the document returned by the server.
The code-based assertion like BeanShell, JSR223, BSF doesn't have a GUI component that identifies the scope. So it signifies that the user should implement all the assertion logic and scope manually. An assertion in JMeter can be applied to all level samples both in a greater and lower scope.
In Thread group, choose Stop Thread under Action to be taken after a sample error. This will stop the test once assertion fails
If you need to limit this behaviour to one request, add a Result Status Action Handler as a child of the request, then set it to Stop Thread
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With