Quality is delighting customers
There is prev shorthand which can be used in the JSR223 Listener in order to access parent SampleResult which in its turn provides getFirstAssertionFailureMessage() function which seems to be exactly what you're looking for
So you can access the failure message as simple as:
String failureMessage = prev.getFirstAssertionFailureMessage();
If you prefer Beanshell - you can use the same code in the Beanshell Listener, however be aware that since JMeter 3.1 it's recommended to use JSR223 Test Elements and G... for any form of scripting, the reasons are in:
I am getting some error now, but I need all the assertion errors to be captured and later i will write one report and make jar.
Do you know how to capture all the assertion errors ?
Thanks in advance for help.
Also be aware that JMeter automatically saves assertion failure messages into .jtl results file, if it doesn't - you can add the next line to user.properties
JMeter restart will be required to pick the properties up.
Thanks very much for elaborating.
Actually I need to write a custom report with pass/fail, assertion errors.
For this I need to get the assertion errors in any java object in bean shell. From there I will arite a report using java. I will Can I get that way?
@Dimitri - Thanks for your details answer.