Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add Assertion in JSR223 using java

How to add assertion on response message in jsr223 postprocessor using java code.

I tried using AssertionResult.setFailure(true); but it is not working

like image 262
Sadha Nanda Avatar asked Mar 12 '26 02:03

Sadha Nanda


1 Answers

Use JSR223 Assertion instead JSR223 PostProcessor

JSR223 Assertion allows JSR223 script code to be used to check the status of the previous sample.

You are missing calling setFailureMessage

AssertionResult.setFailureMessage("Your reason for failure");

The script can check various aspects of the SampleResult. If an error is detected, the script should use AssertionResult.setFailureMessage("message") and AssertionResult.setFailure(true).

like image 51
user7294900 Avatar answered Mar 15 '26 06:03

user7294900



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!