jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shmuel Krakower <>
Subject Re: Custom assertion message
Date Sun, 17 Feb 2013 15:22:50 GMT
You can add an If Controller after the relevant Sampler and put the
following condition:
"${JMeterThread.last_sample_ok}" == "false"

Then you can have a BeanShell Sampler to log out whatever you want, like:
BufferedOutputStream out = new BufferedOutputStream(new
FileOutputStream("log.txt", true));
out.write((vars.get("username") + "," + vars.get("password") +

Another option is to add a Simple Data Writer listener to log all info
(i.e. request and response headers/data) on failing samples (only) into a
file, then you can analyze the results by opening this file in a View
Results Tree listener.

Shmuel Krakower. - re-use your jmeter scripts for application performance
monitoring from worldwide locations for free.

On Fri, Feb 15, 2013 at 1:20 AM, Marcelo Jara <>wrote:

> I am trying to log some custom error messages so that I know exactly why
> something failed. For example, if I try to log in to an application, it
> mail fail for many reasons. I have a Response Assertion that checks for an
> error message. This works fine. But now I also want to log what the
> username and password caused the error since the test plan picks from a
> large data set.
> I've tried added a BeanShell Assertion on top of the Response Assertion,
> but the value of SampleResult is always false.
> Is there a way to act upon the Response Assertion and log a custom error
> message if the Response Assertion fails?

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message