Variables are used to add dynamic content to a scenario.
They may be combined with other variables or with static content (e.g. ${product_${productID}}) and used in a number of places, such as in form parameter values.
Defining 5 variables: a Constant variable, a File variable, a Counter variable, a RandomNumber variable and a JavaScript variable.
xxxxxxxxxxvariablesconstant nameconstant_variable value12345file namecities_file column_names"City" "Country" "Population" "Longitude" "Latitude" is_first_line_column_namesfalse start_from_line1 delimiter";" pathdata/list_of_cities.csv change_policyeach_iteration scopeglobal orderany out_of_valuecyclecounter namecounter_variable start0 end100 increment2 change_policyeach_iteration scopelocal out_of_valuecyclerandom_number namerandom_number_variable min0 max999 predictablefalse change_policyeach_requestjavascript nameMy JSVar descriptionThis is a js var script"function evaluate() {\n\tlogger.debug(\"Computing value of js variable\");\n\treturn new function() \n\t\tthis.firstField = \"a value\";\n\t\tthis.secondField = myLibraryFunction();\n\t;\n" change_policyeach_iterationA string the value of which cannot be modified.
| Name | Description | Accept variable | Required | Since |
|---|---|---|---|---|
| name | The variable name | - | ✓ | |
| description | The variable description | - | - | |
| value | The variable value | - | ✓ |
Defining a Constant variable.
xxxxxxxxxxconstant nameconstant_variable value12345A list or table of values loaded from a text file.
| Name | Description | Accept variable | Required | Since |
|---|---|---|---|---|
| name | The variable name | - | ✓ | |
| description | The variable description | - | - | |
| column_names | The list of column names. Use ${<variableName>.<columnName>} to access variable values. | - | If is_first_line_column_names is false | |
| is_first_line_column_names | If true, the first line of the file can be used as column headers name.The value of this parameter is ignored if column_names parameter is specified.The default value is false. | - | If column_names is not present | |
| start_from_line | The default value is "1". | - | - | |
| delimiter | The delimiter is used to separate data columns.The default value is ",". | - | - | |
| path | The relative (compared to the NeoLoad project folder) or absolute path of the source file. | - | ✓ | |
| change_policy | The policy when the value must change. The "change_policy" value can be:
each_iteration. | - | - | |
| scope | The value scope can be:
global. | - | - | |
| order | The values can be distributed in a set order. The value of order can be:
any. | - | - | |
| out_of_value | When no values are left, several policies can be applied. The value of "out_of_value" can be:
cycle. | - | - |
Defining a File variable.
xxxxxxxxxxfile namecities_file column_names"City" "Country" "Population" "Longitude" "Latitude" is_first_line_column_namesfalse start_from_line1 delimiter";" pathdata/list_of_cities.csv change_policyeach_iteration scopeglobal orderany out_of_valuecycleA numerical variable having a start value, an end value and an incremental value.
| Name | Description | Accept variable | Required | Since |
|---|---|---|---|---|
| name | The variable name | - | ✓ | 6.10 |
| description | The variable description | - | - | 6.10 |
| start | The variable start value | - | ✓ | 6.10 |
| end | The variable end value | - | ✓ | 6.10 |
| increment | The variable increment value | - | ✓ | 6.10 |
| change_policy | The policy when the value must change. The "change_policy" value can be:
each_iteration. | - | - | 6.10 |
| scope | The value scope can be:
global. | - | - | 6.10 |
| out_of_value | When no values are left, several policies can be applied. The value of "out_of_value" can be:
cycle. | - | - | 6.10 |
Defining a Counter variable.
xxxxxxxxxxcounter namecounter_variable start0 end100 increment2 change_policyeach_iteration scopelocal out_of_valuecycleA random numerical value within a value range.
| Name | Description | Accept variable | Required | Since |
|---|---|---|---|---|
| name | The variable name | - | ✓ | 6.10 |
| description | The variable description | - | - | 6.10 |
| min | The variable min value | - | ✓ | 6.10 |
| max | The variable max value | - | ✓ | 6.10 |
| predictable | When true, randomly generated values will have comparable values for two identical tests.e | - | - | 6.10 |
| change_policy | The policy when the value must change. The "change_policy" value can be:
each_iteration. | - | - | 6.10 |
Defining a Random Number variable.
xxxxxxxxxxrandom_number namerandom_number_variable min0 max999 predictablefalse change_policyeach_requestA variable whose value is the result of the execution of a JavaScript script.
| Name | Description | Accept variable | Required | Since |
|---|---|---|---|---|
| name | The variable name | - | ✓ | 7.2 |
| description | The variable description | - | - | 7.2 |
| script | The JavaScript script | - | ✓ | 7.2 |
| change_policy | The policy when the value must change. The "change_policy" value can be:
each_iteration. | - | - | 7.2 |
Defining a JavaScript variable.
javascript nameMy JSVar descriptionThis is a js var script"function evaluate() {\n\tlogger.debug(\"Computing value of js variable\");\n\treturn new function() \n\t\tthis.firstField = \"a value\";\n\t\tthis.secondField = myLibraryFunction();\n\t;\n" change_policyeach_iteration