NeoLoad – Parameterization (Variable)

In NeoLoad, after recording the user step, conducting a check user path and correlating the dynamic value, the next step is ‘Parameterization’ i.e. defining a variable for varying user inputs.

For Beginners: If you are a beginner then you must know what is parameterization? Parameterization is a method to replace the hardcoded value like application URL, User Name, Password etc. with a parameter that has different input values.

Example: You recorded a login page of an application by providing the credentials USER1 and PASS1. When you replay the script, the same credentials are passed. Now, if you want to run a test with 5 different users (USER2, USER3, USER4, USER5 and USER6) then you need to replace the hardcoded value i.e. USER1 with a parameter (say userName). This parameter will have a list of all the values related to the User Name and pass them at the time of the test execution.

Hence a parameter is used to pass different input values in the script.

How to do parameterization in NeoLoad?

To make the parametrization concept easy, a login-logout flow is recorded through the NeoLoad tool. The script has 4 transactions along with the Login page. In the Login page, the ‘username’ and ‘password’ parameter values are passed with the request. Refer to the below figure:

NeoLoad - Parameterization (Variable) - Recorded Flow
Figure 01

Now, the aim is to parameterize the value passing as ‘username’ and ‘password’ so that virtual users can log in through different credentials. For that purpose, you need to follow the below steps:

  1. Select the row under the parameter tab. This tab could be ‘Post parameters’ or ‘Request parameters’ in the script.
NeoLoad - Parameterization (Variable) - User Name
Figure 02
  1. Double-click on the selected row
  2. ‘Request parameter’ pop-up appears
NeoLoad - Parameterization (Variable) - Request Parameter
Figure 03
  1. Go to the ‘Value’ tab
  2. Here, you can see two options:
    1. Use an expression: This option is mainly used for parameterization in which input values are passed from a pre-defined list or external source.
    2. Use an extracted value: This option is used for correlation purposes.
  3. Select ‘Use an expression’ (Default option)
NeoLoad - Parameterization (Variable) - Use an expression
Figure 04
  1. In the ‘Expression’ field, you can see the original (recorded) value
  2. Click on a box with three dots (next to the ‘Expression’ field)
  3. ‘Variable picker’ pop-up appears
NeoLoad - Parameterization (Variable) - variable picker
Figure 05
  1. If you already have a defined variable then choose the appropriate variable from the list else click ‘Variables Manager’.
  2. ‘Variables’ pop-up appears.
Figure 06
  1. The ‘Variables’ option is also available in the menu as shown in the below figure.
NeoLoad - Parameterization (Variable) - NeoLoad Menu
Figure 07
  1. Click ‘New variable’
  2. A pop-up appears with a list of variable types.
NeoLoad - Parameterization (Variable) - Create variable
Figure 08
  1. Since username and password are interdependent variables they need to be passed in a pair. Therefore ‘List’ and ‘File’ are the suitable variable types. We will see both types of variables and understand how they are implemented.

Note: Use any one of the following variable types as per your requirement.

‘List’ Variable Type:

This is a simple type of variable in which you can simply give the name of the variable, and column name and provide the list of values. For the interdependent variables, you can add the columns by using the ‘Add Column’ button and defining the name of the column. Let’s see how.

  • Select ‘List’
Figure 09
  • Enter the name of the variable say userCredential
  • You can also provide a description of the variable. This is optional.
  • Add a column using the ‘Add Column’ button
  • Rename both the column as ‘userName’ and ‘passWord’
  • Add the value of respective variables. Use the ‘Add Value’ button to add more rows.
NeoLoad - Parameterization (Variable) - List Type Variable
Figure 10
  • Click ‘Apply’
  • Click ‘OK’
  • Select the correct variable name from the list
Figure 11
  • Click ‘OK’
Figure 12
  • Click ‘OK’
Figure 13

‘File’ Variable Type:

The core concept of the ‘File’ type variable is similar to LoadRunner. If you have any existing test data file in which credentials are available and separated by a separator like a comma, semi-colon, space, tab etc. then the ‘File’ variable type is most suitable to fulfil your requirement. To implement it:

  • Select ‘File’
NeoLoad - Parameterization (Variable) - File Type Variable
Figure 14
  • Enter the name of the variable say userCredential
  • You can also provide a description of the variable. This is optional.
  • Browse the test data file by clicking the box next ‘File Name’ field.
  • Use the correct separator in the ‘Column separator’. By default, it is semi-colon (;).
  • Press the’ Refresh’ button to display the file data in the correct format.
  • Enter the appropriate value in the ‘Starting from line’ field.
  • Tick-mark ‘Use first line in file as column heading?’, in case the first row is a header of the column in the test data file.
Figure 15
  • Click ‘Apply’
  • Click ‘OK’
  • Select the correct variable name from the list
Figure 16
  • Click ‘OK’
Figure 17
  • Click ‘OK’
Figure 18
  1. Now, the parameterization of the ‘password’ value will be easy because you have already defined the variable. The parameterization of ‘password’ is the same case when you create a variable using the ‘Variables’ (from the menu) option and replace the value with that parameter. Let’s see in the further steps.
  2. Select the ‘password’ row
  3. Double-click on the selected row
  4. ‘Request parameter’ pop-up appears
  5. Go to the ‘Value’ tab
  6. Select ‘Use an expression’ (Default option)
  7. In the ‘Expression’ field, you can see the original (recorded) value
  8. Click on a box with three dots (next to the ‘Expression’ field)
  9. ‘Variable picker’ pop-up appears
  10. Select the appropriate variable i.e. userCredential.passWord
Figure 19
  1. Click ‘OK’
Figure 20
  1. Execute the ‘Check User Path’ and verify the value passing through the variables. Either you can verify the variable input in the respective request (Figure 21) or under the ‘Variables’ tab (Figure 22).
Figure 21
Figure 22

You may be interested:


Leave a Comment