Reputation: 1237
I have a question about assertion message I would like to add in Jmeter JSR223assertion. I know how to put message if an assertion failed
AssertionResult.setFailureMessage(failureMessage);
but if the assertion passed, meaning its all OK is their a way to print a message?
AssertionResult.setFailure(false);
what to add that I could put a message in Jmeter
Upvotes: 1
Views: 6078
Reputation: 168002
For the moment you cannot set "assertion success" message, however you can amend parent SampleResult message to something custom using the following code in the JSR223 Assertion:
prev.setResponseMessage('some custom message')
It will result into:
More information: Scripting JMeter Assertions in Groovy - A Tutorial
Upvotes: 2
Reputation: 34516
There is no way to set a success message.
JMeter being a load test tool mainly, we only report details on failed samplers.
You may request an enhancement explaining why you need this:
Upvotes: 0
Reputation: 58774
Assertion result doesn't have option to set successful message, but JSR223 Assertion as other JSR223 elements have specific variable, you need the log
variable,
You can print a message to log with error level:
log.error("My error...");
or log information to log:
log.info("My message");
also you have log.debug
or log.warn
and maybe other function depending on your log implementation (slf4j/log4j...)
Upvotes: 0