How to schedule a test in JMeter?

No one wants a late-night shift in the office or a restless night just to start a test. Many software testing tools have test scheduling option which helps to overcome sleepless night problem. Apache JMeter also has such a feature which makes Performance Tester life happy.

In JMeter, the Thread Group element has a test scheduling option. When you add the Thread Group element in the ‘Test Plan’, you can see the ‘Specify Thread lifetime’ checkbox (by default unchecked) with greyed out ‘Duration’ and ‘Startup delay’ options.

How to schedule a test in JMeter?
Figure 01

Once you checked (tick marked) the ‘Specify Thread lifetime’ option then both disabled options will be enabled. Now, you can provide the inputs for Duration and Startup delay.

  1. Duration (seconds)This denotes the total duration of the test. One disadvantage to run the test by specifying the duration value is that the test stops immediately when the test duration is completed; without completing the loop (iteration) due to which you could see some differences in transaction count.
    Note: When the ‘Duration’ is specified then checkmark the ‘Infinite’ option for ‘Loop Count’.
  2. Startup delay (seconds): If you provide value for ‘Startup delay’ then JMeter adds the specified delay to start the test after pressing the ‘Run’ button. In Non-GUI mode, after hitting the test execution command, JMeter does not fire any request until the specified delay period is over. In simple words, the test starts at a time (=current system time + startup delay)
Figure 02

Example: If the current system time is 2020/01/01 14:00:00 and the provided startup delay (seconds) is 900 then the test will be started at 2020/01/01 14:15:00.

Figure 03

How to schedule a test in Apache JMeter?

  1. In the Thread Group, checkmark the ‘Specify Thread lifetime’ option
  2. Specify either ‘Duration (seconds)’ i.e. test duration or ‘Loop Count’
  3. Specify ‘Startup delay (seconds)’
  4. Press the ‘Run’ button (in GUI mode) / Run the test execution command (Refer to the article – How to run JMeter test in Non-GUI mode?)