I am using Apache JMeter 3.1 and in my test suite I have a BeanShell PreProcessor
. When I run the scrip, in the Log Viewer
I can see there are errors in the bean shell script. But the error message is very limited, how can I get the complete error?
For example, an error I see in the Log Viewer
is as follows,
ERROR - jmeter.util.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of: ``// Following is a sample for input // "abc.org/def/xyz . . . ''
Is there a way I can retrieve the complete error?
You can view the log entries through the log viewer panel available in the JMeter IDE. The panel can be launched/closed by clicking either Options → Log Viewer menu item or by clicking the icon in the top right corner. The log levels can be set through the Options→ Log Level menu item.
Beanshell Assertion – An advanced assertion with full access to JMeter API. Java conditional logic can be used to set the assertion result. __Beanshell Function – A JMeter Function that allows execution of custom BeanShell code during a sampler run.
ctx is the most powerful variable exposed to BeanShell. It represents the JMeterContext class, which is virtually JMeter itself. It provides read/write access to the underlying JMeter engine, samplers, and their results as well as variables/properties.
The JSR223 postprocessor allows you to use precompiled scripts within test plans. The fact that the scripts are compiled before they are actually used brings a significant performance boost compared to other postprocessors.
You can enable debug output in at least 2 ways:
Putting your code inside the try block like:
try {
//your code here
}
catch (Throwable ex) {
log.error("Something went wrong", ex);
throw ex
}
This way full exception stacktrace will be available in jmeter.log file
I would rather recommend switching to JSR223 Elements and Groovy language as Groovy is more Java-compliant and provides better performance. See Groovy Is the New Black for details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With