Scala JSR223 script support since 2.11
e.eval("""s"a is $a, s is $s"""")
I added Scala 2.13 jars and tried to execute script, it can display constants in response
But I can't add JMeter's bind variables as log
, I tried with:
log.info(a);
$log.info(a);
Or can't print values to log, tried also
var a:Int = 10
println(a)
JMeter's bindings code:
Bindings bindings = engine.createBindings(); final Logger logger = LoggerFactory.getLogger(JSR223_INIT_FILE); bindings.put("log", logger); // $NON-NLS-1$ (this name is fixed) engine.eval(reader, bindings);
Tried also using bindings but it isn't in context
bindings.get("log").info("aa");
Exception
ERROR o.a.j.p.j.s.JSR223Sampler: Problem in JSR223 script JSR223 Sampler, message: javax.script.ScriptException: not found: value bindings
How can I submit Scala JSR223 script using JMeter/Java bindings variables?
EDIT
Open Scala issue JSR223 - Engine ignores bindings parameters