Google Search

Tuesday, October 15, 2013

Load Runner Parameterization


Load Runner Parameterization



What is parameterization?

VuGen generates a Vuser script composed of functions when a business activity is recorded. Parameterization is used to replace the hard coded in the Vuser script obtained while recording, with parameters by which the repeated use of same values can be avoided. Parameterization is generally done to test with multiple set of data or records. A parameter replaces a literal value in the script .It provides the ability to test the script with different values and also reduces the size of the script.


The different parameter types are:
1)    Date/Time
2)    File
3)    Group Name
4)    Iteration Number
5)    Load generator Name
6)    Random Number
7)    Table
8)    Unique Number
9)    User Defined function
10) Vuser  Id

Parameterization Steps:

1)Right click on the value to be parameterized and select the option “Replace with parameter”




2) The following window appears



3) Rename the Parameter name .In this case it is renamed as NewParam_4(you can give whatever name you think fits well). The parameter type chosen is File. Click the Properties Tab.



4) Click the “Create Table” Tab and then click ok.



5 a) Values can be added to the data file either by using the tab ”Add Row” or by using the Edit with Notepad Tab.
Here the Add Row tab is used.



5 b) Click the Edit with Notepad tab. Here you can add more values in the File and save the changes.



6) We have 2 options for Select Column
      a) By number.
      b) By name
a)    By Number: This option will take values from the first column i.e.  NewParam_4



b)    By Name: By selecting this option the parameter will take values from the column Employee Name. This option is more meaningful .If there are several columns in a data file, we can rearrange columns and the values will be taken correctly.


By default the parameter value is taken from the first line in the NewParam_4 file. If we want to start from the second value in the parameter list, we can change the value in the “First data line:” option to 2.
The options available in the “Select next row” dropdown are:
a) Sequential:
 b) Random:
c) Unique:
Update methods in parameterization:
Each occurrence



The Each occurrence method instructs the Vuser to use a new value for each occurrence of the parameter. This is useful when the statements using a parameter are unrelated. For example, for random data, it may be useful to use a new value for each occurrence of the parameter.
Each iteration:



The Each iteration method instructs the Vuser to use a new value for each script iteration. If a parameter appears in a script several times, the Vuser uses the same value for all occurrences of the parameter, for the entire iteration. This is useful when the statements using a parameter are related
Once:



The Once method instructs the Vuser to update the parameter value only once during the scenario or session step run. The Vuser uses the same parameter value for all occurrences and all iterations of the parameter. This type may be useful when working with dates and times.
If the value that is parameterized occurs in the script more than once then the other occurrences also need to be replaced by the parameter name. It is done in the following way .Right click -> Replace more occurrences and replaces those values.



To view the parameterized value on replaying the script, we have to enable the extended log radio button and check the Parameter substitution check box in the log section of the Run-time settings and click ok.
Run-time settings->Log->extended log->Parameter substitution.
On replaying the script the value is captured in the Parameter name. In this case the value is captured in the NewParam_4.






No comments:

Post a Comment