Open In App

Timers in JMeter

Last Updated : 30 Mar, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

There are various test plan elements in JMeter like Thread group, controllers, listeners, timers, etc. In this article, we are going to learn about Timers. Timers are extremely important to maintain balance while conducting performance tests using Jmeter.

Need of Timers in JMeter

Jmeter threads usually run one after another without any time delay. This can be unrealistic in nature because a normal user will take time gaps to read or think between performing every action. That time is called Think Time and it should be added to make the script more realistic and reliable. To perform such operations JMeter is providing 9 types of timers and the user can select the one which suits the scenario.

Timer’s Present in JMeter

  • Constant Timer
  • Gaussian Random Timer
  • Uniform Random Timer
  • Constant Throughput Timer
  • Synchronizing Timer
  • JSR223 Timer
  • BeanShell Timer
  • BSF Timer
  • Poisson Random Timer

Every timer has its own usability. For example, a Bean shell timer is usually used to give delay time or think timer in between sampler requests. The constant timer is the basic timer among all the given ones. Now let us see in brief about some commonly used timers of Jmeter

Constant Timer

This can be used to add some delay/think time between each request. The constant timer has the following components

Constant Timer

 

The name that we have given is displayed on the tree and here thread delay is taken in milliseconds. For example, if we want to add 3 seconds think time then we have to enter 3000 as shown above.

BeanShell Timer 

This is a scripting-based timer in which we can develop the logic of how to implement a timer. The Bean shell timer has the following components.

BeanShell Timer

 

JSR223 Timer 

JSR223 Timer is also a scripting-based timer similar to Bean shell timer. In JSR223 Timer we can create delays between the user requests using the JSR223 Scripting language. JSR223 Timer components are as follows

JSR223 Timer

 

Uniform Random Timer 

Uniform Random can be used to add a random amount of think time between the user requests. The Uniform Random Timer has the following components.

Uniform Random Timer

 

Name element is meant to give a name to the timer that is to be displayed in the tree. Random Maximum Delay as the name suggests we should enter the maximum delay or think time then it will give a random think time to user requests which are not above the given value. For example, if we don’t want the time time to exceed 10sec then we should enter the value to this is 10000. Constant Delay Offset is an additional value taken in milliseconds. Similarly, other timers are used according to the situation or the requirement of testplan.

Adding Timers to Test Plan

Adding Timers to the test plan is similar to adding a thread group. The path to adding the timer is as follows test plan/thread group >> Add >> Timer >> required timer

Adding Timers to Test Plan

 


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads