How to set Start and end time in Jmeter Scheduler as variables - jmeter

I am trying to load test my app by setting the Start and end time in Scheduler as a variables eg:
Start Time : ${START_TIME}
End Time : ${END_TIME}
bit Jmeter is not allowing to save it.Is it not a configurable option ?
This is what I want to do
jmeter -Jduration=600 -n -t /path/to/your/test/plan.jmx
This will kick of the tests immediately for 10 mins (600s)
Can the start time be configured in such a way that it is always a current time

You can configure it but it has to be a valid Date
If you want to control duration of your test I would recommend the following:
Test Start Time can be set by OS means (cron jobs, scheduled tasks, continuous integration system build plan, etc.)
Test Duration can be set via JMeter Property.
For instance, you want your test to run for 2 hours. In order to achieve this you need to provide the value of "7200" into "Duration" section of thread group. If you put ${__property(duration,,)} or ${__P(duration,)} into "Duration" input of thread group and set this duration=7200 property in i.e. user.properties or jmeter.properties files (they both live under /bin folder of your JMeter installation) or provide it as a command-line argument as
jmeter -Jduration=7200 -n -t /path/to/your/test/plan.jmx -l /path/to/results/file.jtl
The test will run for 2 hours (plus some additional time to gracefully shut down all the test threads).
See Apache JMeter Properties Customization Guide for more details on JMeter Properties use cases.

Related

Jmeter Duration time does not get reflected in Azure Load Testing

I am trying to execute my JMeter script via Azure Load Testing, I have setup a duration time in the JMeter script but when I execute via Azure Load Testing ,it does not get reflected, I cant figure from where the time is getting set. I am not sure how to configure that or where it gets overridden. Any support is appreciated.
If you provided duration_in_sec in your Azure Load Test Configuration - it will override whatever you have in the .jmx test script
If you didn't - the duration will be taken from the Thread Group(s)
If you haven't specified duration in the Thread Group - the test will end as soon as the last thread (virtual user) executes last iteration of the last Sampler in the last Thread Group.
Otherwise you test will run forever.
More information: JMeter Tutorial: Getting Started With the Basics

Jmeter + Jenkins Performace plugin

I have set thread properties as
${__P(threads,)}
for Number of user and
${__P(rampup,)}
for rampup period in jmeter GUI.
Then created a job in jenkins, chosen 'This project is parameterized' and included String parameter 'THREADS' & 'RAMPUP'. I have mentioned the right path for the execution, included -Jthreads=%THREADS% and -Jrampup=%RAMPUP% under Execute Windows batch command.
The right path was set for generating the performance report.
After choosing 'Build with parameters', assume the 'THREADS' as 10 and 'RAMPUP' as 0, the build is successful.
The issue is with the 'Performance report' as every time the 'HTTP Request' count is displayed as 20 by default irrespective of whatever value is provided at the time of build. The thread count of 10 is not being considered as a parameter. By default the HTTP Request count shows as '20' requests instead of the actual '10' requests in reports.
Performance Plugin doesn't know anything about Jenkins parameters, most probably you configured it badly so it consumes the same .jtl results file all the time and doesn't load any updates.
Further assistance is not possible without seeing the screenshot of the freestyle project or the code of your Jenkins JMeter pipeline.

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

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.

JMeter getting hanging in GUI mode

I'm having problem with jmeter while running the test plan. Suddenly my Jmeter starts hanging and appears as a black screen in GUI mode. I was running recording controller with multiple thread groups (4 thread groups). Each thread group with 25 users.
I'm using Jmeter 2.11 (current version). I'm not sure whether it is due to overload or some other reason.
Regards
Nayasoft
Don't ever use GUI mode for load test. Run JMeter in command-line non-GUI mode as follows
jmeter -n -t /path/to/your/testplan.jmx -l /path/to/testresults.jtl
Also if you have any listeners in your test plan - disable or remove them as well. After test execution you should be able to open testresults.jtl file with the listener of your choice and analyze results, but don't use them during load test.
Make sure that you following Performance Checklist and other recommendations from JMeter Performance and Tuning Tips guide
You have run out of JMeter/JVM memory. You can increase in with environment variables, command line options when you start jmeter, or change some values in jmeter.properties
This page describes how to start jmeter with more memory.
http://jmeter.apache.org/usermanual/get-started.html
One easy way is to set the environment variable before running jmeter:
set JVM_ARGS="-Xms1024m -Xmx1024m"
This will allow your tests to run longer before running out of memory, but if you store results in memory (for instance using View Results Tree listener), you will still run out eventually. For long running tests, or accurate measurement of short running tests, it is better to run in non-GUI mode, and save results to file, instead of memory.
Graphs can still be generated after the run from the saved results using jmeter utilities.

Resources