JMeter __jexl3 function reference: syntax, parameters, and practical examples for parameterizing test plans with dynamic values.
Also documented in context in the full Functions and Variables reference.
The jexl function returns the result of evaluating a Commons JEXL expression. See links below for more information on JEXL expressions.
The __jexl3 function uses Commons JEXL 3
| Name | Required | Description |
|---|---|---|
| Expression | Yes | The expression to be evaluated. For example, 6*(5+2) |
| Name of variable | No | The name of the variable to set. |
The following variables are made available to the script:
-
log- the Logger for the function -
ctx- JMeterContext object -
vars- JMeterVariables object -
props- JMeterProperties (classjava.util.Properties) object -
threadName- String containing the current thread name -
sampler- current Sampler object (if any) -
sampleResult- previous SampleResult object (if any) -
OUT- System.out - e.g.OUT.println("message")Jexl can also create classes and call methods on them, for example:
Systemclass=log.class.forName("java.lang.System");now=Systemclass.currentTimeMillis();Note that the Jexl documentation on the web-site wrongly suggests that โdivโ does integer division.
In fact โdivโ and โ/โ both perform normal division. One can get the same effect
as follows:
i= 5 / 2;i.intValue(); // or use i.longValue()