I am in need of scheduling my test such that my JMeter script automatically runs without I having to manually execute it daily. This can be accomplished via a Windows cron job but I do not know how to configure the JMeter script to run as a Windows cron job. Normally I use the command "jmeter -n -t path\filename.jmx -l path\log.csv" to execute my JMeter script via the command line so I assume if I can make this command run as a cron job it should solve the problem theoretically. So I sincerely appreciate if someone could provide the steps and details to accomplish this, thanks.
You can do it using Windows Task Scheduler like
Action -> Create Task
On "Actions" tab create a new action like:
Change JMeter and .jmx script location to match your details.
Each time your task runs the file with current date should appear in "bin" folder of your JMeter installation like Test_20180514.jtl
for today
Just in case here is exported task:
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2018-05-14T07:50:02.7061254</Date>
<Author>aldan\anonymous</Author>
<URI>\JMeter</URI>
</RegistrationInfo>
<Triggers />
<Principals>
<Principal id="Author">
<UserId>S-1-5-21-2873627350-121124179-3591956082-1001</UserId>
<LogonType>InteractiveToken</LogonType>
<RunLevel>LeastPrivilege</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>false</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>PT72H</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context="Author">
<Exec>
<Command>c:\windows\system32\cmd.exe</Command>
<Arguments>/c c:\jmeter\bin\jmeter.bat -n -t c:\jmeter\extras\Test.jmx -l c:\jmeter\bin\Test_%date:~10,4%%date:~4,2%%date:~7,2%.jtl</Arguments>
</Exec>
</Actions>
</Task>
Be aware that easier option could be using Jenkins to orchestrate your builds, this way you will have history, metrics, conditional failure criteria and performance trend charts.
See Continuous Integration 101: How to Run JMeter With Jenkins article for more information regarding adding performance tests under Jenkins control
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments