JMeter Constant Timer
JMeter Constant Timer
A Constant Timer in JMeter ensures that each thread pauses for the same amount of time between requests. This helps in simulating real-world user behavior where requests are not sent continuously without delay.
Add a Constant Timer
To apply a timer to a single sampler, we need to add the timer as a child element of the sampler. This timer will be applied before the sampler is executed.
Create a Thread Group
- Right-click Test Plan > Add > Threads (Users) > Thread Group.
- Leave all fields as default.
Add HTTP Request Defaults
- Right-click Thread Group > Add > Config Element > HTTP Request Defaults.
- Set Server Name to:
example.com
.
Add HTTP Requests
- Right-click Thread Group > Add > Sampler > HTTP Request.
- Rename it to Home Page.
- Set Path as:
/
.
Add More HTTP Requests
- Add another HTTP Request, rename it to About Page, and set Path as
/about
.
Add Listener to View Results
- Right-click Thread Group > Add > Listener > View Results in Table.
Save and Run the Test
- Save the test and run it to observe request execution timing.
Add a Constant Timer
- Right-click Thread Group > Add > Timer > Constant Timer.
- Set Thread Delay to
300
milliseconds.
Save and Run the Test Again
- Run the test again and compare results.
Start Time for About Page = Start Time for Home Page + Sample Time + 300ms.
This confirms that a 300 milliseconds delay is applied before each request, ensuring controlled execution.