Scheduling tests

In performance testing we sometimes need to schedule test execution. Across both Linux and Windows there are a variety of ways to achieve this.

Linux

Linux has numerous ways of scheduling events.

AT command

The AT command allows you to simply designate a time and a command to execute. In this example we are executing the jmeter test plan at 00:05.

$ at 00:05 AM at> /home/username/apache-jmeter-5.2.1/bin/jmeter -n -t test.jmx at> ^d job 3 at 2020-03-10 00:05

Crontab

The CRON scheduler allows you to simply designate a time and a command to execute. In this example we are executing the jmeter test plan at 02:00.

$ crontab -e

0 2 * * * /home/username/apache-jmeter-5.2.1/bin/jmeter -n -t test.jmx

>> Save and Exit the file

Sleep command

The SLEEP command allows you to simply designate a time delay and a command to execute. In this example we are executing the jmeter test plan in 1 hour (3600 seconds).

sleep 3600 && /home/username/apache-jmeter-5.2.1/bin/jmeter -n -t test.jmx

Windows

Windows has numerous ways of scheduling events.

Timeout Command

The TIMEOUT command allows you to simply designate a time delay and a command to execute. In this example we are executing the jmeter test plan in 1 hour (3600 seconds).

timeout /t 3600 && jmeter -n -t test.jmx

Task Scheduler

The Task scheduler allows you to simply designate a time and a command to execute. In this example we are executing the jmeter test plan at 02:00.

SCHTASKS /CREATE /SC DAILY /TN "MyTasks\Jmeter task" /TR "C:\apache-jmeter-5.2.1\bin\jmeter.bat" /ST 02:00

Linux/Windows

In additional to the built in commands in both Linux and Windows it may also be beneficial to consider using Jenkins which can be used to schedule tasks including jmeter tests.

FURTHER READING

Jenkins

Previous
Previous

Performance Journey

Next
Next

Docker and Jmeter