Think Time setting is available under the ‘General’ category of ‘Runtime Settings’ in LoadRunner. Refer to below screenshot. (For more details What is Think Time?)
Before elaborating the think time setting, you must understand how does LoadRunner pause the Vuser. Actually, LoadRunner uses lr_think_time() function to add a delay (or think time) between two transactions. This function pauses the Vuser for a given period of time and then release.
Note: Do not use lr_think_time() inside a transaction.
How to insert think time in the LoadRunner script?
Write down the lr_think_time(); function in between two transactions and pass a positive integer number as an argument of the function. The argument value will be considered as a think time in second(s).
Example: lr_think_time(10); // Vuser will wait for 10 seconds before starting the next transaction.
What are the settings available for Think Time?
There are four settings available for think time settings in LoadRunner:
1. Ignore think time
Choosing this option instructs the Vuser to ignore the given think time [lr_think_time()] in the script and run the script without any delays in between two transactions. This option is helpful during replay and debugging the script. Also, this is a default setting. ‘Limit think time to XX seconds’ option is disabled for this setting.
2. Replay think time as recorded
This setting allows to use the same value of think time which has been given as an argument of lr_think_time(). It could be either a recorded value (captured during recording) or updated value (manually updated postscript generation). “Limit think time to XX seconds” option is enabled for this setting. You can set the maximum think time value by checked it and restrict the Vuser to cross the maximum think time value.
3. Multiply Recorded think time by X
This setting multiplies the think time value by specified times like 2 times, 3 times etc. If you have given think time value as 10 seconds and ‘multiply recorded think time by’ value as 2, then Vuser will pause for 20 seconds before starting to the next step. ‘Limit think time to XX seconds’ option is enabled for this setting. You can set the maximum think time value by checked it and restrict the Vuser to cross the maximum think time value.
4. Use random percentage of recorded think time
This setting helps to generate random think time value between the specified percentage range. This helps to simulate a real-world scenario during the test. The Minimum value range is 1% to 150% and the maximum value range is 50% to 10000%. ‘Limit think time to XX seconds’ option is enabled for this setting also. You can set the maximum think time value by checked it and restrict the Vuser to cross the maximum think time value.
You can define a think time variable in global.h and pass as an argument in think time function. This will help you to change the think time value at one place only without missing any think time function.
Hard-coded Think Time Value:
Pass Think Time as a Variable:
Other Setting on Think Time tab:
- On clicking ‘Use defaults’ button, VuGen resets the think time setting and enables the first option i.e. Ignore think
You may be interested: