Jmeter - BeanShell

About

Beanshell script in JMeter

Snippet

Log

log.info("Log.info in BeanShell Sampler");

You will see this message in the log

Property

JMeter - Property

props.put("sample_variables","test.id"); 

Variable

JMeter - Variable

// Get the value of one variable
VariableA=vars.get("VariableA")
// Create a new variable from the first one
vars.put("VariableB","myValue"+VariableA); 

Diagnostic

The errors are not shown in a View Result Tree. You have to check the log instead.

Example of errors in the log file:

2013/10/09 14:02:19 ERROR - jmeter.util.BeanShellInterpreter: 
Error invoking bsh method: eval	Parse error at line 2, column 9.  Encountered: ( 
2013/10/09 14:02:19 WARN  - jmeter.modifiers.BeanShellPreProcessor: 
Problem in BeanShell script org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval	
Parse error at line 2, column 9.  Encountered: ( 

Powered by ComboStrap