Rectangle 27 0

java JMeter doesn't fail on BeanShell errors?


prev.setSuccessful(false);
//your main Beanshell code goes here
prev.setSuccessful(true);

Given your test relies on scripting I would recommend switching to JRS223 Test Elements and Groovy language, it will be much better from performance perspective, see Groovy Is the New Black article for more information, benchmarks, and scripting best practices.

So if any Beanshell error will occur in-between these prev.setSuccessful methods - the parent sampler will be failed.

Thanks. Apparently faster and got better error reporting, which is nice, however this approach still requires active effort to code the script in a specific way to capture such failures. As a developer, I see it as a job for the platform itself, after all the interpreter was executed and knows if errors were present, so why can't such information be used to abort the test or set a failure instead of forcing the developer to use tricks to reach the same result? Anyway, thanks for your answer, it is my best alternative so far.

The only way to get Beanshell PostProcessor failure in the test results is amending parent sampler result setting it to "Failure" at the Beanshell script beginning and to "Success" at the script failure, something like:

Note