JMeter __RandomFromMultipleVars 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 RandomFromMultipleVars function returns a random value based on the variable values provided by Source Variables.
The variables can be simple or multi-valued as they can be generated by the following extractors:
- Boundary Extractor
- Regular Expression Extractor
- CSS Selector Extractor
- JSON Extractor
- XPath Extractor
- XPath2 Extractor
Multi-value vars are the ones that are extracted when you set -1 for Match Numbers.
This leads to creation of match number variable called varName_matchNr and for each value to the creation of variable varName_n where n = 1, 2, 3 etc.
| Name | Required | Description |
|---|---|---|
| Source Variables | Yes | Variable names separated by ` |
| Variable Name | No | A reference name for reusing the value computed by this function. |
Examples:
\${__RandomFromMultipleVars(val)}will return a random string based on content of variable val taking into account whether they are multi-value or not
\${__RandomFromMultipleVars(val1|val2)}will return a random string based on content of variables val1 and val2 taking into account whether they are multi-value or not
\${__RandomFromMultipleVars(val1|val2, MYVAR)}will return a random string based on content of variables val1 and val2 taking into account whether they are multi-value or not and store the result in MYVAR