Jmeter run 2 test plans sequentially command line - maven

I have 2 test plans for 2 different processes that I want to test using Jmeter; both scripts are implemented and can be run individually via the Jmeter GUI.
However, is it possible to run one test plan using the command line, and then once the first test plan finishes, the second test plan gets kicked off. Basically, I want to run one test plan after another: NOT at the same time...
Eventually we want to put these 2 test plans on a server and have them run one after the other using some maven script, but for now is there any way to accomplish this using Jmeter's command line?

For the command-line non-GUI mode just run your files using shell script like:
jmeter -n -t test1.jmx -l result1.jtl
jmeter -n -t test2.jmx -l result2.jtl
You can also pass the same file via -l command-line option, results of test2.jmx will be appended to the results of test1.jmx.
For Maven execution just copy both .jmx scripts to src/test/jmeter folder of your project - Maven will execute the tests sequentially.
After test execution you will be able to find results files under target/jmeter/results folder, one file per .jmx script. The results can be merged together via i.e. Merge Results tool
More information:
JMeter Maven Plugin
Five Ways To Launch a JMeter Test without Using the JMeter GUI

Related

JMeter slaves are not reading property file values

I am running jmeter distributed test. I have lot of combinations to test, so created property files (.properties) to execute different tests.
For example:
I have 1 master and 2 slave machines. I have kept jmx script in master machine and test data in all slaves
Started jmeter-server in all slave machines
Ran distributed test from master with following command
"jmeter -n -t script.jmx -p condition1.properties -R SlaveIP1,SlaveIP1 -l results.jtl"
Results:
Test runs well but with default values defined in script. In my case test duration defined in script is 300 secs whereas test duration in condition1.properties file is defined as 900, but test always runs for 300 seconds.
This is just an example, I have many other parameters defined in property file and should be picked up while running the test.
This problem is happening only in case of master & slave condition, otherwise running test from single machine picks up all values defined in property file.
According JMeter list of command-line options you can't use -p in the case of disturbed testing, but use -G instead.
-G, --globalproperty <argument>=<value>
Define Global properties (sent to servers)
e.g. -Gport=123
or -Gglobal.properties

How do I prevent JMeter from exiting upon successful execution of the test?

I am running JMeter version 3.3 in non-GUI mode and I do not want the process to exit upon successful execution of the test.
I have tried running following command:
$ ./bin/jmeter -n -t scenarios/WebTestPlan.jmx -LDEBUG -Jjmeterengine.force.system.exit=false
But it doesn't do the trick. How do I achieve desired behavior?
If basing your approach on time is acceptable and you don't need JMeter report to be generated on Heroku, add a tearDown Thread Group that contains an infinite sleep using Timer.
If you need report, then do a sleep in a shell

Quit Jmeter after tests and save aggregate reports

Yesterday due to some reason my Jmeter Machine crashed and I do not have results.
These results run overnight on a laptop, what I am looking for is, I can quit Jmeter ones tests are done and my reports get saved automatically.
Given you run JMeter in command-line non-GUI mode like:
jmeter -n -t /your/script.jmx -l /test/results.jtl
JMeter should store test execution results in the results.jtl file. When the test is finished you will be able to open the file with the Listener of your choice using "Browse" button and analyze the results.
Even in that case you can loose some data in case of JVM crash, by default JMeter doesn't store each single result, it periodically flushes results data. You can add the next line to user.properties file in order to tell JMeter to store each single result immediately (JMeter restart will be required to pick the property up):
jmeter.save.saveservice.autoflush=true
Alternative way is passing the property via -J command-line argument like:
jmeter -Jjmeter.save.saveservice.autoflush=true -n -t /your/script.jmx -l /test/results.jtl
See Listeners > Default Configuration to learn more about JMeter defaults, what properties are available and what can be changed to make results to look accordingly to your requirements
Run the JMeter always in Non-GUI mode.
Following is the command:
jmeter.bat -n -t Sctipt.jmx -l results.jtl
-l : option to save the results.
When the test is completed, automatically results will be saved in results.jtl file. you can give full path also, otherwise, saves the file in current directory i.e., JMeter folder where 'jmeter.bat' file present.
Don't keep any listeners in the script as they utilizes system resources.

insert delay in jmeter in capturing results

I have a jmeter script which does a remote ssh and executes a R script now I need the jmeter to delay wherein it starts capturing results in the listeners after say 6 seconds how can I achieve that.
I don't think you'll be able to do it using JMeter Test Elements however you can insert a delay on SSH command level using sleep command like:
./your_R_Script && sleep 6
See How to Run External Commands and Programs Locally and Remotely from JMeter for more tips and tricks on how to kick off remote processes from JMeter

Jmeter - running GUI test from terminal

I'm trying to run Jmeter GUI test from terminal (in MAC). instead of running the GUI tests (that work when running from GUI), it created another folder next the existing one - named without underscore. my tests folder is 'Jmeter_Tests' and the terminal run creates 'Jmeter Tests'
the command (running from jmeter bin directory):
./jmeter -n -t /Users/myusername/Jmeter_Tests/SB1.jmx
could the terminal command run the GUI test?
As far as I know there is no way to execute a command line statement to open JMeter GUI mode and then immediately start a test. (Please correct me if that was not your question!)
In most cases you want to run non-gui for real test execution anyway. When using terminal to start a .jmx test plan you must pass the following flags:
%JMETER_HOME%/jmeter -n -t /path/to/test_plan.jmx -l /path/to/desired/output.jtl
Its also suggested to use this as well:
-j /path/to/desired/jmeter_log.txt
For more details, visit this page: JMeter Getting Started - GUI Mode
Edit: To get nice data analysis of a JTL file after a non-gui test run, check out CMDRunner.jar from the JMeter Plugins packages: CMDRunner Man Pages

Resources