No one wants a late-night shift in the office or restless night just to start a test. Many software testing tools having 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, Thread Group element has test scheduling option. When you add Thread Group element in the ‘Test Plan’, you can see ‘Specify Thread lifetime’ checkbox (by default unchecked) with greyed out ‘Duration’ and ‘Startup delay’ options.
Once you checked (tick marked) ‘Specify Thread lifetime’ option then both disabled options will be enabled. Now, you can provide the inputs for Duration and Startup delay.
- 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 ‘Infinite’ option for ‘Loop Count’.
- Startup delay (seconds): If you provide value for ‘Startup delay’ then JMeter adds the specified delay to start the test after pressing ‘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 word, the test starts at a time (=current system time + startup delay)
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.
How to schedule a test in Apache JMeter?
- In the Thread Group, checkmark ‘Specify Thread lifetime’ option
- Specify either ‘Duration (seconds)’ i.e. test duration or ‘Loop Count’
- Specify ‘Startup delay (seconds)’
- Press ‘Run’ button (in GUI mode) / Run the test execution command (Refer to the article – How to run JMeter test in Non-GUI mode?)