LoadRunner Parameter Type

LoadRunner Parameter Type

Following are the types of parameter in LoadRunner:

  1. Custom
  2. File
  3. Date/Time
  4. Group Name
  5. Iteration Number
  6. Load Generator Name
  7. Random Number
  8. Unique Number
  9. User Defined Function
  10. Vuser ID
  11. XML

a. Custom:

To specify the parameter data type, you can use Custom parameter type. This is a simple parameter type and having single value input. The custom parameter type is specially used for the application URL, port number etc.

LoadRunner Parameter Types - Custom
Figure 01: LoadRunner Parameter Types – Custom

b. Date/Time: 

This parameter type generates the value in date and time format. It can generate past, current and future date/time. You can also specify the format of the value by choosing the given date/Time format. Apart from this, you can also create a custom format and generate the value as per your need. Date/Time parameter has a variety of formats which help to generate the value in any format.

LoadRunner Parameter Types - Date/Time
Figure 02: LoadRunner Parameter Type – Date/Time

 To create a custom date/time format, you can use the below tokens:

Figure 03: LoadRunner Parameter Type – Date/Time – Custom Format

Offset: This option is used to generate past and future date/time. You could create a Date/Time parameter, choose the format that you need for the date then select ‘Offset parameter by’ and enter day/hour/minute/seconds which you want to set as an offset.

Let’s say if you have given 30 (days) 00:00:00 (HH:MM:SS) in the offset field then LoadRunner will generate a future date value. The value will be 30 days ahead from the current date.

To generate the past date you need to checkmark ‘Prior to current date’ option. This will give you a value having a past date or time.

‘Working days only’ option provides the feature to generate a date of working days only. LoadRunner automatically adjusts the working day while generating the value.

Update value on:  This setting helps to specify when the next parameter value will be chosen? It has the following options

  • Each Iteration: When a new iteration starts then only a new date/time value will be generated. Else the same parameter value will be continued throughout the iteration.
  • Each Occurrence: When a parameter has multiple occurrences in the same iteration then this option will generate a new date/time value for each occurrence. For example, if a parameter has 3 occurrences in the same iteration then 3 new date/time values will be generated.
  • Once: This option restricts Vuser to use the date/time value only one time throughout the test. ‘Once’ option is helpful when you need unique values in the test.
Figure 04: LoadRunner Parameter Type – Date/Time – Settings

c. File

This is very common and frequently used parameter type in LoadRunner. When you replace a value with a new parameter in the script, by default LoadRunner shows File as a parameter type. Refer to the below figure (Figure 05):

Figure 05

File Path: File path shows the name of the .dat file having the same name as parameter. This file contains the test data which appear in the tabular format in the Parameter List pop-up (Figure 06). The column name in the table is also as same as the parameter name. You can add, edit or delete the parameter value directly in the table or by using ‘Edit with Notepad…’ option. If you already have test data in text, .dat or excel file then use ‘Import Values’ option to import the data in the script. By default, the parameter name and .dat file name is the same which can be changed as per your need.

Note: You can also browse an existing .dat file of the different script along with test data using the ‘Browse’ option next to ‘File path’.

LoadRunner Parameter Types - File
Figure 06: Loadrunner Parameter Type – File

Add Row: Additional Test Data (values) can be inserted using the ‘Add Row’ button. You can insert multiple rows as equal to the test data.

Add Column: If 2 parameters have one to one relationship then File parameter type is very much helpful. An additional column can be inserted using the ‘Add Column’ button and named the parameter that would be used in the script. Refer to the below figure, previously it had only one parameter (p_UserName) and later on, a new column added (named p_Password). When you click the ‘Add Column’ button, a pop-up opens where you can provide the name of the new parameter/column. Insert the name of the parameter and then click ‘OK’.

Figure 07: Add a new column

Edit with Notepad: You can add test data either by clicking on cells or using ‘Edit with Notepad’ option.

Figure 08: ‘Edit with Notepad’ option

Select Column: Using this option, you instruct VuGen/LG which value needs to be picked up? Here 2 options are available.

  • By Number: It specifies the column number. If you select ‘By Number’ option and provide the value as 2 then 2nd column test data will be selected.
  • By Name: It specifies the column name. The name of columns appear in the drop-down, you can select the column appeared in the dropdown list.

File Format: In the File Format section,

  • Column delimiter: It specifies the type of separation between the test data columns. You can choose Comma, Tab and Space as a column delimiter.
  • First data line: It specifies the starting row number from where the data has to be read. If you provide the value as 3 then the value of 3rd row i.e. PerfMatrix03,Pass03 will be picked up for the first iteration and continue from 3rd row onward in next iterations as per the ‘Select next row’ and ‘Update value on’ settings.
Figure 09: File Format Setting

Select next row: This option helps to set-up the data selection method during the test. The methods are ‘Sequential’, ‘Random’, ‘Unique’ and ‘Same line as XXX.

  • Sequential: It specifies the sequential (i.e. one by one) selection of the value from the given list.
  • Random: This input option selects a random number from the given list.
  • Unique: It helps to set-up a unique selection of the values.
  • Same line as <parameter_name>: When two parameters are mapped in a table then only this option appears in the dropdown. On selecting this option, all the values in the same row are picked-up.
Figure 10: ‘Select next row’ input options

Update value on: This option helps to specify when the next parameter value will be chosen? The possible inputs are:

  • Each Iteration: When a new iteration starts then only a new value will be selected. Else the same parameter value will be continued throughout the iteration.
  • Each Occurrence: When a parameter has multiple occurrences in the same iteration then this option will pick a new value for each occurrence from the parameter list. For example, if a parameter has 3 occurrences in the same iteration then 3 new values will be selected.
  • Once: This option restricts Vuser to use the available value only one time throughout the test. ‘Once’ option is helpful when you need to pass unique values in the test.
Figure 11: ‘Update value on’ input options

When out of values: This option specifies the action to be taken when test data is exhausted. It is available only when you have the setting like

Select next row -> Unique and Update value on -> Each Iteration

Figure 12

OR

Select next row -> Unique and Update value on -> Each Occurrence

Figure 13

If you have a setting like Select next row -> Unique and Update value on -> Once then ‘When out of values’ option will be disabled.

Figure 14

There are 3 actions or inputs available:

  • Abort Vuser: It instructs Vuser to exit from test run when test data is fully consumed.
  • Continue in a cyclic manner: It instructs Vuser to continue using the same set of test data in a repetitive manner.
  • Continue with last value: It instructs Vuser to continue the test with the last value of the parameter list till the test run ends.
Figure 15: ‘When out of values’ input options

Allocate Vuser values in the Controller: VuGen helps to distribute block-wise parameter values. This option is available only when you have selected ‘Select next row’ and ‘Update value on’ inputs as same as shown in ‘When out of value’ option.

If you have a setting like Select next row -> Unique and Update value on -> Once then ‘When out of values’ option will be disabled.

It has two sub-options:

  • Automatically allocate block size: LoadRunner allocates the block size by using its own logic.
    Note: This option is disabled when you choose Select next row -> Unique and Update value on -> Each occurrence
  • Allocate <N> values for each Vuser: You can specify the number of parameter value allocated to each Vuser by providing block size.
Figure 16

Let’s take one example, if there are 18 values in the parameter list of userID and block size is 3 then userID value will be distributed among 6 Vuser like this:

Figure 17

d. Group Name: 

A group name is specified while creating the scenario in the controller or Performance Center. That group name can also be parameterized using the parameter setting.

Select the ‘Group Name’ as a parameter type and provide the text format for the group name. You can also add custom text format using the ‘Add format->’ button. Similarly ‘Delete format<-‘ and ‘Reset formats’ buttons have their respective functions.

LoadRunner Parameter Types - Group Name
Figure 18: LoadRunner Parameter Type – Group Name

e. Iteration Number: 

This parameter type generates the current iteration number. It is generally used when you need to develop some scripting logic using the current iteration number.

For example, out of 5 transactions in a script, the 3rd transaction should run half of the total iteration. So you can enclose the 3rd transaction within an ‘if’ condition with logic p_IterationNo%2==0.

To add this type of parameter, select the ‘Iteration Number’ as a parameter type and provide the text format for the group name. You can also add custom text format using the ‘Add format->’ button. Similarly ‘Delete format<-‘ and ‘Reset formats’ buttons have their respective tasks.

LoadRunner Parameter Types - Iteration Number
Figure 19: LoadRunner Parameter Type – Iteration Number

f. Load Generator Name: 

The name of the load generator (the computer on which the Vuser is running). You can specify the format of the Load Generator name using the given format. ‘Add format->’, ‘Delete format<-‘ and ‘Reset formats’ have their respective tasks as suggested by their name.

LoadRunner Parameter Types - Load Generator Name
Figure 20: LoadRunner Parameter Type – Load Generator Name

g. Random Number: 

This parameter type generates a random number within the specified range. ‘Min’ shows the smallest number of the range and ‘Max’ represents the largest number of the given limit. You can specify the format of the random number like other parameter types by using ‘Number format’ option. ‘Update value on’ option has the same function as explained above.

LoadRunner Parameter Types - Random Number
Figure 21: LoadRunner Parameter Type – Random Numebr

Look at the below example, the provided inputs will generate a 3 digit random number in the range of 51 to 250.

Figure 22

h. Table:

‘Table’ parameter type has almost similar features as ‘File’ parameter type. The only difference is the ‘File’ type uses one cell value for each parameter occurrence whereas the ‘Table’ type uses several rows and columns as parameter values, just like an array of values. Using the table type, you can fill in an entire table with a single command. 

LoadRunner Parameter Types - Table
Figure 23: LoadRunner Parameter Type – Table

Refer to the ‘File’ parameter type to get full information on input options on the ‘File’ parameter.

i. Unique Number: 

‘Unique Number’ parameter generates a number in the given range and pass in the script. Specify the start number, block size per Vuser (the number of unique numbers to set aside for each Vuser) and number format to generate the required unique numbers. For example, if you specify a start value as 1 and a block size of 100 then 1 to 100 numbers will be assigned to the first Vuser, 101 to 200 numbers will be assigned to the second Vuser and so on. During the test, the unique number will be generated for a particular Vuser from the allocated number range only.

LoadRunner Parameter Types - Unique Number
Figure 24: LoadRunner Parameter Type – Unique Number

Update value on: 

This setting helps to specify when the next parameter value will be chosen. The possible inputs are:

  • Each Iteration: When a new iteration starts then only a new value will be selected. Else the same parameter value will be continued throughout the iteration.
  • Each Occurrence: When a parameter has multiple occurrences in the same iteration then this option will pick a new unique value for each occurrence from the parameter list. For example, if a parameter has 3 occurrences in the same iteration then 3 new unique values will be selected.
  • Once: This option restricts Vuser to use the available value only one time throughout the test. ‘Once’ option is helpful when you need to pass unique values in the test.

When out of values:  This option specifies the action to be taken when test data is exhausted. The possible values are:

  • Abort Vuser: It instructs Vuser to exit from test run when unique values are fully consumed.
  • Continue in a cyclic manner: It instructs Vuser to continue using the same set of values in a repetitive manner.
  • Continue with last value: It instructs Vuser to continue the test with the last value of the parameter list till the test run ends.

j. User Defined Function: 

You can create User-defined functions in LR. But when using User-defined functions to substitute parameter values, you would have to create an external .dll library for the same.

LoadRunner Parameter Types - User Defined Function
Figure 25: LoadRunner Parameter Type – User Defined Function

k. Vuser ID: 

The ID number assigned to the Vuser by the Controller during a scenario run. When you run a script from VuGen, the Vuser ID is always -1. You can also specify the format of the Vuser ID. Use ‘Add format->’, ‘Delete format<-‘ and ‘Reset formats’ option as per the requirement.

LoadRunner Parameter Types - Vuser ID
Figure 26: LoadRunner Parameter Type – Vuser ID

l. XML:

‘XML’ type parameter is useful for web services. You can use an XML type parameter to replace the entire structure with a single parameter.

LoadRunner Parameter Types - XML
Figure 27: LoadRunner Parameter Type – XML

‘Select next value’, ‘Update value on’, ‘When out of values’ and ‘Allocate Vuser values in the Controller’ have similar functions as explained in the ‘File’ type parameter.


You may be interested:


Leave a Reply

Your email address will not be published. Required fields are marked *