Parameterization in LoadRunner
VuGen Parameterization Tutorial Summary:
What is Parameterization
- Replacing hard coded values in the script is called Parameterization.
- Parameterization helps in :
- Reducing script size
- Avoiding cache effect
Type of Parameters
#1. Date/Time – Whenever we have to replace a date value with a parameter, Date/Time parameter is used. Any post with past date is not valid. To keep it updated, Date/Time parameter provides flexibility to get the current or future date. If past date is needed, it handles that too.
#2. Group Name -We can generate a parameter on the basis of group that we select on controller for the script while execution. This parameter will only work while running the script on controller.
#3. Iteration Number – This replaces the parameter with current iteration number. This is generally used to build some logic. For example- when we want some code in script to be executed alternatively. For this, we will use the iteration number to check whether it is even or odd number and for one of the condition we will execute the function.
#4. Load Generator Name – We can also generate parameter while executing the script on controller on the basis of load generator name on which that script is running. This parameter only works while running the script on controller.
#5. Vuser ID – When we run the script on controller, it assigns a unique id to each virtual user that emulate during the execution. This parameter type is used –
- To print the Vuser ID in an external file for script-debugging purpose.
- To segregate transaction volume based on Vuser ID
#6. File – Some time we want to pass the specific value in the script. In such cases, we use file and enter the values that want to use during execution. LR provides options to run the script with provided list sequentially or randomly on next iteration.
In few cases we want to use a set of values passed to the script. In such cases, we can use same file for the other parameter value as well.
#7. Random Number – As per need, Vugen also generates random value from the provided range.
#9. Unique value – In few situations, script is not allowed to pass any duplicate value. In such cases, unique parameter is used to avoid failures due to duplicate value,.
#10. User Defined function – Such parameter calls a function whose return value replaces the parameter name.
#11. XML – XML Parameter Types are used for multiple valued data contained in an XML structure. XML parameters are widely used with Web Service scripts and with SOA services.