Think Time setting is available under the ‘General’ category of ‘Runtime Settings’ in LoadRunner. Refer to the below screenshot. (For more details What is Think Time?)
Before elaborating on the think time setting, you must understand how LoadRunner pause the Vuser. Actually, LoadRunner uses the 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 releases.
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 between two transactions. This option is helpful during replay and debugging the script. Also, this is a default setting. The ‘Limit think time to XX seconds’ option is disabled for this setting.
2. Replay think time as recorded
This setting allows us 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 checking it and restricting 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 a 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. The ‘Limit think time to XX seconds’ option is enabled for this setting. You can set the maximum think time value by checking it and restricting 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 values 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 checking it and restricting the Vuser to cross the maximum think time value.
You can define a think time variable in global.h and pass it as an argument in the think time function. This will help you to change the think time value in 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 the ‘Use defaults’ button, VuGen resets the think time setting and enables the first option i.e. Ignore think
You may be interested: