Configure the JMeter JSR223 Timer timers: properties, defaults, and practical usage notes for building reliable load tests.
Part of the Timers category. Also documented in context in the full Component Reference.
The JSR223 Timer can be used to generate a delay using a JSR223 scripting language,
| Name | Required | Description |
|---|---|---|
| Name | No | Descriptive name for this element that is shown in the tree. |
| ScriptLanguage | Yes | The scripting language to be used. |
| Parameters | No | Parameters to pass to the script. The parameters are stored in the following variables: - Parameters - string containing the parameters as a single variable - args - String array containing parameters, split on white-space |
| Script file | No | A file containing the script to run, if a relative file path is used, then it will be relative to directory referenced by “user.dir” System property The return value is converted to a long integer and used as the number of milliseconds to wait. |
| Script compilation caching | No | Unique String across Test Plan that JMeter will use to cache result of Script compilation if language used supports [Compilable](https://docs.oracle.com/javase/8/docs/api/javax/script/Compilable.html) interface (Groovy is one of these, java, beanshell and javascript are not) :::note See note in JSR223 Sampler Java System property if you’re using Groovy without checking this option ::: |
| Script | Yes (unless script file is provided) | The script. The return value is used as the number of milliseconds to wait. |
Before invoking the script, some variables are set up in the script interpreter:
log- (Logger) - can be used to write to the log filectx- (JMeterContext) - gives access to the contextvars- (JMeterVariables) - gives read/write access to variables:vars.get(key); vars.put(key,val); vars.putObject("OBJ1",new Object());props- (JMeterProperties - class java.util.Properties) - e.g.props.get("START.HMS");props.put("PROP1","1234");sampler- (Sampler) - the current SamplerLabel- the name of the TimerFileName- the file name (if any)OUT- System.out
For details of all the methods available on each of the above variables, please check the Javadoc