I am using JMeter as a unit test tool, in parameterised calls where I expect some of the responses to be 500 internal server errors. I am using BeanShell Assertions to chec
Using a BeanShell assertion, force the HTTP Sampler to pass and then pass/fail on a regular Beanshell assertion statement instead:
if (ResponseCode.equals("500") == true) {
SampleResult.setResponseOK();
/* the same is
SampleResult.setSuccessful(true);
SampleResult.setResponseCodeOK();
SampleResult.setResponseMessageOK();
*/
}
String path = SampleResult.getURL().getPath();
if (!path.contains("anerror")) {
Failure = true;
FailureMessage = "URL Path: didn't contain \"anerror\"" +
System.getProperty("line.separator") + "URL Path detected: " + path;
}