NeoLoad – File Variable

‘File’ is a type of variable in NeoLoad to read the external test data from a file and use it in the script. The external file contains a list of test data either sourced from the production server or generated by a test data generator. The ‘File’ variable type is the easiest option to get the test data available in an excel, .csv, .txt file. For this purpose, you need to simply browse the file and specify the column separator. NeoLoad will display the file data in a tabular format. The test data can be simply picked up by the column name; just like we have seen in the ‘List‘ variable type.

The specific use of the ‘File’ variable type is to define the dependent test data through an external file like name, address, ID, account number, order number etc.

Example: A dependent value set of First Name, Last Name and Employee ID available in an external file.

The advantage of the ‘File’ variable type is that it meets the requirement of the use of bulk test data. You can simply browse an external file and use the test data. Use the ‘Import dataset’ option where the pre-defined data formats and values are required.

It is recommended to use the ‘List’ variable type for a small set of data like 2 to 5 rows instead of using the ‘File’ variable type. The ‘File’ variable type leads to an extra process to call an external file and fetch the data which is an extra burden for the tool.

Inputs of ‘File’ type variable

  1. Name: To provide the name of the variable to be used in the script. This is a mandatory input.
  2. Description: To describe the use of the variable. This is an optional input.
  3. Values: To specify the test data
    1. File Name: Browse the external test data file or provide the actual/relative path of the test data file
    2. Import dataset…: To select pre-defined data of a specific format
    3. Column separator: To define the data (column) separator like comma, semi-colon, space etc.
    4. Starting from line: To define the starting row of the table. The data will be picked from the defined row onwards. The input type is an integer number Example: 1, 5, 10 etc. This is a mandatory input.
    5. Use first line in the file as column heading?: If the first row of the file has a column name then check-mark this option.
    6. Open: It opens the test data file
    7. Refresh: It refreshes the data of the table in case of any change in the original file.
    8. Previous: Use to see the value of the previous rows
    9. Next: Use to see the value of the next rows
  4. Value change policy: To define the setting when the next row (data) will be picked
    1. On each use
    2. On each request
    3. On each page
    4. On each iteration (Default value)
    5. For each Virtual User instance
  5. Variable values distribution policy: To define the scope and distribution setting of the variable
    1. Scope: The available values are:
      1. Local
      2. Global (Default Value)
      3. Unique
    2. Order: The available values are:
      1. Sequential
      1. Random
      2. Any (Default Value)
    3. When Out of Values: The available values are:
      1. Cycle values (Default Value)
      2. Stop the test
      3. Return the value “<No Values>”

Example

Consider, an ‘Order Submission’ scenario where a user requires User Name, Password, Flat No., Street Name, City, State and Pin Code to complete the order. A test data generator has generated the required test data and saved it in a CSV file. Now, to parameterize the required values, we can use the ‘File’ type variable.

First of all, we need to provide the name of the variable in the ‘Name’ field (say ‘OrderData’) then browse the CSV file. You can see the test data in the table. In case an appropriate ‘Column separator’ is not used then enter the column separator and press the ‘Refresh’ button. The test data will be separated into different columns. The ‘Value change policy’ is set to ‘on each iteration’ with Global scope, Sequential order of test data and in a cyclic manner, when out of data situation occurs. Refer to the below screenshot of how this scenario will be illustrated.

NeoLoad - File Variable - Order Data
Figure 01

To pick the value from the list, we need to write ${<variable name>.<column name>} in the script.

Example: ${OrderData.userName} & ${OrderData.passWord}

NeoLoad - File Variable
Figure 02

Note: You can also validate the variable by using the ‘Test’ option. The variable should return the value from the list.

NeoLoad - File Variable
Figure 03

You may be interested:


Leave a Comment