LoadRunner – Runtime Settings – Think Time

LoadRunner Runtime Settings - Think Time

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?)

LoadRunner - Runtime Settings - Think Time
Figure 01: Think Time Setting

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.

LoadRunner - Runtime Settings - Example
Figure 02: LoadRunner Think Time Example

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.

LoadRunner - Runtime Settings - Ignore Think time
Figure 03: Ignore Think Time

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.

LoadRunner - Runtime Settings - Replay
Figure 04: Replay think time as recorded

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.

LoadRunner - Runtime Settings - Multiply Recorded Think Time
Figure 05: Multiply Recorded think time by X

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.

LoadRunner - Runtime Settings - Use Random
Figure 06: Use random percentage of recorded think time

Tips:

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:

Figure 07: Hard-coded Think Time

Pass Think Time as a Variable:

LoadRunner - Runtime Settings - Example
Figure 08: Think Time Variable
Figure 09: 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
Figure 10: Use Defaults settings

You may be interested:


Leave a Reply

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