Schedule JMeter test plan to be started at a certain time - jmeter

I want to run a load test on my server. I have built couple of different test plans and I need to execute all the test plans at the same time.
I'm using a few instances of JMeter on three different machines and I'm trying to figure out whether I can schedule my JMeter scripts to be started at a certain time?
One way would be to run, on each of my machines, a script in which I run my JMeter test plans at a certain time
The reason I decided to not use JMeter in master/slave mode is that each of my test plans would generate a load from different parts of my application. So I need each of my JMeter instances to run a different Thread Group.

If you don't want to install software as Jenkins
You can schedule jmeter execution in exact time using crontab, example:
Schedule a cron to execute at 2am daily.
This will be useful for scheduling database backup on a daily basis.
0 2 * * * /bin/sh backup.sh

Depending on your operating system:
Windows: Task Scheduler
Linux: crontab
MacOS: launchd
You can also consider installing a CI/CD solution like Jenkins, BuiltBot or CruiseControl which provide VCS system integration as well as possibility to schedule builds at the specific time or run basing on various triggers.

a solution to my question is to use "at" command which allows us to schedule a job at a certain time. Since I needed my test script to be executed only once, I decided to take this approach.
For example, following command would schedule a task at 12:01 PM (you need to make sure that your user is assigned all the required permissions to run this job)
echo "JMETER_HOME/jmeter -n -t MT_TEST_PLAN.jmx -l MY_TEST_RESULT.jtl" | at 12:01 PM

Although, I do not support the usage of Jmeter GUI for executing load tests, it depends with how many users you are executing. If the user load is small, you can use Start Time/End Time in the Threadgroup.
If you are using windows machines to execute load test, you can use windows task scheduler to run load tests at some specific time.

Related

Looking for a way to run a workflow on all self-hosted agents in a pool for Github actions

I’m trying to run a maintenance workflow on all agents.
It’s a cleaning job like “docker system prune”. I wish it runs on all self-host agents (about 12 agents) weekly on Sunday night.
I noticed that workflows can run with on schedule event. This is great.
But I didn’t find a way to make all self-hosted agents to run the workflow. Any suggestions?
I believe that this problem is more about your operating system(s), not about workflows on GitHub side. It might be possible to do as workflow, but then your agents are requiring either to be on host operating system, or have access for Docker socket. (I don't know how you are hosting them). Either way, might be insecure depending on if host is used on something else as well.
As GitHub docs are stating, you are responsible about your operating system.
In general, you can schedule maintenance jobs with cron, might be the most used one. How to install it, depends on your operating system.
To add scheduled work, run command crontab -e, select editor and add line to the end:
0 3 * * 0 /usr/bin/docker system prune -f to run 03:00 AM Sunday weekly.
However, if you really want to use workflows, you could read some docs on here. It states, that "Labels allow you to send workflow jobs to specific types of self-hosted runners, based on their shared characteristics." So you could create specific maintenance job for every runner with different label. This requires many scheduled jobs as runners are not intended to launch multiple times for same job.

How Can I compare output of 2 different JMeter runs automatically?

I want to compare 2 different jmeter runs.
I have a jenkins job to do that which triggers jmx which in turn call Rest APIs.
Lets say, I executed Jmeter run for one time. I will refer this as run 1
Now, after 30 minutes, I will again run the same jenkins job and will again run the jmeter test. I will refer to it as run 2.
So, now i have 2 runs and i want to compare run1 and run2, specifically the response time.
How can I automate that so that everytime this happens, i can have the difference in response time of APIs ?
I tried searching, found few articles (Compare results from a previous test in jmeter) but it did not really help :(
Please let me know how can this be achieved ?
You can use MergeResults plugin in order to compare 2 test executions and plot execution chart and/or have differences in the CSV file.
If you want to run it in non-GUI mode from Jenkins job - go for JMeterPluginsCMD Command Line Tool which has MergeResults plugin to run it in command-line mode.
You can install both the plugins using JMeter Plugins Manager

Run Scenarios with time constrain on Jenkins using ruby cucumber framework

I have two scenarios, scenario 1 should run at 5:00 PM everyday. Gather the DB results from it and save it on yaml file. I have to use these results to run scenario 2 which needs to be run next day at 8AM. How can I implement this on Jenkins.
Write now I am trying to implement through rake task. My logic is if the yaml file is present run scenario 2 or else run scenario 1.
Is there a better way to do it?
I need these two scenarios on the same jenkins job.

Is this possible to automate the JMeter scripts running schedule?

Is this possible to schedule the JMeter scripts.for example I want to run the same script every hour and want to automate this process.Is this possible?
Yes, there are many options:
Linux : Use cron
Windows Task Scheduler
Jenkins

How can I schedule my tests in JMeter?

I started with tests in general and with JMeter in particular. I would like to schedule the launch of my scenarios every five minutes.
There is a startup configuration tab in my group of units, in which I can set the date and time.
However, whenever I try to set the date and time, those settings always get overridden with another date. Any guidance would be appreciated.
To Schedule JMeter Scripts you can use crontab for linux and for windows you can use at.exe.

Resources