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.
xxxxxxxxxx
variables
constant
name constant_variable
value12345
file
name cities_file
column_names"City" "Country" "Population" "Longitude" "Latitude"
is_first_line_column_namesfalse
start_from_line1
delimiter";"
path data/list_of_cities.csv
change_policy each_iteration
scope global
order any
out_of_value cycle
counter
name counter_variable
start0
end100
increment2
change_policy each_iteration
scope local
out_of_value cycle
random_number
name random_number_variable
min0
max999
predictablefalse
change_policy each_request
javascript
name My JSVar
description This is a js var
script"function evaluate() {\n\tlogger.debug(\"Computing value of js variable\");\n\treturn
new function() "a value\";\n\t\tthis.secondField = \n\t\tthis.firstField = \
myLibraryFunction();\n\t" ;\n
change_policy each_iteration
A 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.
xxxxxxxxxx
constant
name constant_variable
value12345
A 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.
xxxxxxxxxx
file
name cities_file
column_names"City" "Country" "Population" "Longitude" "Latitude"
is_first_line_column_namesfalse
start_from_line1
delimiter";"
path data/list_of_cities.csv
change_policy each_iteration
scope global
order any
out_of_value cycle
A 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.
xxxxxxxxxx
counter
name counter_variable
start0
end100
increment2
change_policy each_iteration
scope local
out_of_value cycle
A 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.
xxxxxxxxxx
random_number
name random_number_variable
min0
max999
predictablefalse
change_policy each_request
A 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
name My JSVar
description This is a js var
script"function evaluate() {\n\tlogger.debug(\"Computing value of js variable\");\n\treturn
new function() "a value\";\n\t\tthis.secondField = \n\t\tthis.firstField = \
myLibraryFunction();\n\t" ;\n
change_policy each_iteration