LoadRunner Parameterization

After covering the basics of script recording and debugging in LoadRunner, the next step is script enhancement. Script enhancement in LoadRunner implies adding some additional functionalities to make the script simple, comprehensive and regressive. The first step under the script enhancement part is ‘Parameterization’.

For Beginners: If you are a beginner then you must know what is parameterization. Parameterization is a method to replace hardcoded values 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 p_userID). This parameter will have a list of all the given values 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 LoadRunner?

There are 2 methods for parameterization in LoadRunner:

a) When you do not have a predefined parameter list:

  1. Go to the script.
  2. Select the value (text) which you want to parameterize.
  3. Right-click on the selected text.
  4. Click the ‘Replace with Parameter’ option.
  5. Click ‘Create New Parameter…’
Figure 01: Number denotes the step
  1. The ‘Select or Create Parameter’ pop-up will open then provide the value for the ‘Parameter name’ and ‘Parameter type’ fields and click the ‘Ok’ button.
Figure 02: ‘Select or Create Parameter’ pop-up
  1. Another pop-up will appear stating ‘Do you want to replace all occurrences of the string with a parameter?’. Click ‘Yes’ to replace all the occurrences of the text. This will replace the parameterized value with the parameter name.
Figure 03
  1. Set the scope of the replacement and click on the suitable option. The ‘Find Next’ option identifies the next occurrence of the text. The ‘Replace’ option replaces the highlighted text only whereas the ‘Replace All’ option replaces all the occurrences of the text as per the selected scope.
Figure 04: Scope of replacement

b) When you have a predefined parameter list:

  1. Go to the script.
  2. Select the value (text) which you want to parameterize.
  3. Right-click on the selected text.
  4. Click the ‘Replace with Parameter’ option.
  5. Choose an appropriate parameter suggested below the ‘Parameter List…’.
Figure 05
  1. A pop-up appears stating ‘Do you want to replace all occurrences of the string with a parameter?’. Click ‘Yes’ to replace all the occurrences of the text. This will replace the parameterized value with the parameter name.
LoadRunner Parameterization
Figure 06
  1. Set the scope of the replacement and click on the suitable option. The ‘Find Next’ option identifies the next occurrence of the text. The ‘Replace’ option replaces the highlighted text only whereas the ‘Replace All’ option replaces all the occurrences of the text as per the selected scope.
LoadRunner Parameterization
Figure 07

How to restore the original value of the parameter in LoadRunner?

  1. Right-click on the parameter that you want to be restored.
  2. Click ‘Restore original value’.
Figure 08: Restoring the original value