I need a Beanshell sampler that runs only when a specific HTTP Request Sampler fails. I want this so I can write certain variables to the terminal console when this failure occurs during test execution.
I know I can save the http response to a file upon failures [using built in jmeter component Save Responses to File] and include variables in the name of the file saved, but this is too heavyweight for what I am trying to achieve.
Why not set up a beanshell sampler with an if condition that tests the result's HTTP status? The script would look something like this:
if (!ctx.getPreviousResult().getResponseCode().equals("200")) {
log.info("Your log message here.");
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments