Skip to content

__jexl3

JMeter __jexl3 function reference: syntax, parameters, and practical examples for parameterizing test plans with dynamic values.

Difficulty
intermediate
Guide type
reference
Estimated read time
1 min read
Last verified version
Verified JMeter 5.6

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

NameRequiredDescription
ExpressionYesThe expression to be evaluated. For example, 6*(5+2)
Name of variableNoThe 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 (class java.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()
On this page