NeoLoad – Variable Types
For users to satisfy the many types of criteria while creating a performance test script, NeoLoad offers a choice of variables. The menu has an option called “Variables,” as may be seen in the figure below.
Figure(1)
Again click variable
Figure(2)
Then, after clicking the ‘New variable’ button, the ‘Variables’ pop-up appears:
Figure(3)
The types of variables in NeoLoad are as follows:
- Counter: Integer generation from a counter is done using a counter.
- List: Data is produced from a table of string values using this.
- File: Data is read from an external file using a file.
- Data: It is used to read data from a database using SQL.
- Random integer: Creating a random integer is done using this.
- Random String: To create a random string of varying lengths, use the Random String function.
- Constant String: It is used to supply a constant value to the scenario.
- Password: It is used to assign a password value to the scenario.
- Date: It can generate dates and timings in a variety of formats.
- Current date: It is used to produce the current date and time in a variety of forms.
- Random UUIDs: The method is used to produce random UUIDs.
- Shared Queue: It allows Virtual Users to share values.
- JavaScript: This language is used to produce values.
A Counter variable for NeoLoad
NeoLoad uses a type of variable called “Counter” to create values that keep track of counting. The addition of custom logic, loop counting, iteration numbering, feeding the counting, and other uses benefit from the use of counter variable types. These inputs are available for the “Counter” variable type:
- Name: To specify the variable’s name (Counter) for use in the script. This entry is required.
- Description: To explain the function of the variable. This input is not required.
- Starting point: The counter variable’s initial value. For instance, 0, 1, etc. This entry is required.
- Maximum value: The maximum value that can be created for the counter variable. This entry is required.
- Increment value: The pace at which the variable’s value must be increased. This entry is required.
- Value-change strategy: To specify the setting for changing the value,
- Every time (Default value)
- On every page
- every request
- every repetition
- For each instance of a Virtual User
- Policy for distributing variable values: To specify the variable’s range and distribution settings
- Scope: The choices are as follows:
- Regional
- Worldwide (Default Value)
- Unique
- When Defying Values: The choices are as follows:
- Cycle values (Default Value)
- End the test.
- Give the result “No Values”
- Scope: The choices are as follows:
Example
Consider a request that verifies an order’s status as it moves from the “Entering” to the “Pending Payment” to the “Order Placed” states. A loop is created around the request, and it ends when the status changes to “Order Placed.” The necessity at this point is to keep track of the loop’s execution until it ends. Create a counter variable called “countertop,” give it a start value of 1, an end value of 1000, and an increment of 1. The loop will only have a local scope, and each time it is used, the value will be modified. See the screenshot below for an illustration of this scenario.
NeoLoad – List Variable
In NeoLoad, the variable type “List” is used to specify the values of the variable in a list. By selecting values from the predefined list, NeoLoad substitutes the variable that was used in the script. Multiple columns can be added with the ‘List’ variable type, allowing for the simple use of the dependent value set. The ‘List’ variable type is specifically used to specify the name, address, ID, account number, order number, etc.
For example, a dependent value set of Employee ID, First Name, and Last Name.
The ‘List’ variable type’s only drawback is that you must manually enter the columns and associated values; Alternatively, you can use the ‘Import dataset’ option, which provides pre-defined data formats and values.
List type variable inputs
- Name: To specify the variable’s name for use in the script. This entry is required.
- Description: To explain the function of the variable. This input is not required.
- Values: Describe the test data.
Starting from the line: Starting with the defined row, the data will be selected. The type of input is an integer number. as in 1, 5, 10, etc. This entry is required.- importing a dataset to choose pre-defined data in a particular format
- Insert Column: to include a new dependent data column in the table
- Eliminate Column: in order to eliminate the current column from the table. Simply choose the column name and click the delete button.
- Bring Value: Adding a new row
- Value to Delete: To remove the chosen row
- Value-change strategy: To specify the timing for selecting the following row (of data),
- On each use
- On each request
- On each page
- On each iteration (Default value)
- For each Virtual User instance
- Policy for distributing variable values: To specify the variable’s range and distribution settings
- Scope: The choices are as follows:
- Local
- Global (Default Value)
- Unique
- Order: The choices are as follows:
- Sequential
- Random
- Any (Default Value
- When Defying Values: The choices are as follows:
- Cycle values (Default Value)
- Stop the test
- Return the value “<No Values>”
- Scope: The choices are as follows:
Example
To authenticate a user and grant access to the application, a login page comprises User Name and Password fields. Now we can use the ‘List’ type variable to parameterize the User Name and Password fields. First, we need to enter the variable’s name in the ‘Name’ field (let’s say ‘Credential’), then we need to add two columns with the names ‘userName’ and ‘password’. We can add the relevant values to the rows under the appropriate columns after the columns have been created. When an out-of-data situation arises, the “Value change policy” is set to “on each iteration” with global scope, sequential order of test data, and in a cyclical fashion. See the screenshot below for an illustration of this scenario.
Write $variable name>.column name> in the script to select a value from the list.
An illustration would be $Credential.Username & $Credential.passWord.
Note: The ‘Test’ option can also be used to validate the variable. The value from the list should be returned by the variable.