Variable Types

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.

Screenshot (209).png

           Figure(1)

Again click variable

Screenshot (212).png

                                 Figure(2)

Then, after clicking the ‘New variable’ button, the ‘Variables’ pop-up appears:

Screenshot (213).png

                                              Figure(3)

The types of variables in NeoLoad are as follows:

  1. Counter: Integer generation from a counter is done using a counter.
  2. List: Data is produced from a table of string values using this.
  3. File: Data is read from an external file using a file.
  4. Data: It is used to read data from a database using SQL.
  5. Random integer: Creating a random integer is done using this.
  6. Random String: To create a random string of varying lengths, use the Random String function.
  7. Constant String: It is used to supply a constant value to the scenario.
  8. Password: It is used to assign a password value to the scenario.
  9. Date: It can generate dates and timings in a variety of formats.
  10. Current date: It is used to produce the current date and time in a variety of forms.
  11. Random UUIDs: The method is used to produce random UUIDs.
  12. Shared Queue: It allows Virtual Users to share values.
  13. 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:

  1. Name: To specify the variable’s name (Counter) for use in the script. This entry is required.
  2. Description: To explain the function of the variable. This input is not required.
  3. Starting point: The counter variable’s initial value. For instance, 0, 1, etc. This entry is required.
  4. Maximum value: The maximum value that can be created for the counter variable. This entry is required.
  5. Increment value: The pace at which the variable’s value must be increased. This entry is required.
  6. 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
  7. Policy for distributing variable values: To specify the variable’s range and distribution settings
    1. Scope: The choices are as follows:
      • Regional
      • Worldwide (Default Value)
      • Unique
    2. When Defying Values: The choices are as follows:
      • Cycle values (Default Value)
      • End the test.
      • Give the result “No Values”

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.

Screenshot (217).png

 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

  1. Name: To specify the variable’s name for use in the script. This entry is required.
  2. Description: To explain the function of the variable. This input is not required.
  3. 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
  4. 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
  5. Policy for distributing variable values: To specify the variable’s range and distribution settings
    1. Scope: The choices are as follows:
      • Local
      • Global (Default Value)
      • Unique
    2. Order: The choices are as follows:
      1. Sequential
      2. Random
      3. Any (Default Value
    3. When Defying Values: The choices are as follows:
      1. Cycle values (Default Value)
      2. Stop the test
      3. Return the value “<No Values>”

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.

NeoLoad - List Type Variable

Write $variable name>.column name> in the script to select a value from the list.

An illustration would be $Credential.Username & $Credential.passWord.

NeoLoad - List Variable

Note: The ‘Test’ option can also be used to validate the variable. The value from the list should be returned by the variable.

NeoLoad - List Variable
Scroll to Top