How Timer Scope Works
Timers are important to simulate think time in our script. Think time is the time a user takes between two interactions with the application to do things such as the following:
- Read screen content
- Enter login and password
- Enter order form data
To avoid unexpected behavior, it's critical to understand how and when Timers are executed.
There are two rules, and these rules apply regardless of the location of the timer.
Rule 1: Timers Are Executed before Each Sampler in Their Scope
For example, consider the following script:
Figure 4.6: Our script with one timer
This script will be executed in the following order:
Figure 4.7: Execution order of our script with one timer
As we can see, Timer1 is:
- Executed three times because of the scoping rule
- Executed once before Sampler1
- Executed once before Sampler2
- Executed once before Sampler3