Quit Jmeter after tests and save aggregate reports - jmeter

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.

Related

JMeter - The JVM should have exited but did not

I have a script which does the following:
Script executes fine in GUI mode:
jmeter -q C:/Users/503289283/Downloads/eml_base.properties -t Service_Names.jmx
When executed in Non-GUI mode i.e.
jmeter -q C:/Users/503289283/Downloads/eml_base.properties -n -t Service_Names.jmx
We receive the below message:
Have added an entry in the log4j2.xml file. Restarted JMeter.
Executed the script again in Non-GUI mode. Still see the same message. Didn't find anything suspicious in the log file.
Not sure where is the issue. Please help.
Regards,
Ajith
Script executes fine in GUI mode:
jmeter -q C:/Users/503289283/Downloads/eml_base.properties -t Service_Names.jmx
it doesn't mean that the "script executes fine", it means that you're just opening Service_Names.jmx test plan in JMeter GUI, the script is being "executed" when you click this button:
Or press CTRL+R
Your test cannot be finished successfully (in fact there are no successful Sample Results) because SSH Command sampler is still waiting for the response from the SSH server.
I don't know what eml status command does and how does the output look like,try running it via new instance of Bash (or whatever is your shell) interpreter as:
/bin/bash -c "eml status"
If the command is interactive, i.e. the output never ends until you press the button, you will need to reconsider your approach.
More information: How to Run External Commands and Programs Locally and Remotely from JMeter

JMeter - Reading a Custom Property file in Non-GUI mode

I have a custom property file, which is read via
jmeter -q C:/Users/503289283/Downloads/eml_base.properties -t Service_Names.jmx
Same thing when executed in Non-GUI mode i.e.
jmeter -q C:/Users/503289283/Downloads/eml_base.properties -n -t Service_Names.jmx
Throws an undesirable message at the end of run
Script is running for a longer duration than it should. Output received is perfect.
Solving this could reduce the Test duration (Non-GUI mode).
Thanks for your support.
Regards,
Ajith
The "undesired" message you're getting is from jsch library which is reading some stream hence JMeter cannot gracefully terminate its threads because SSH connection is open.
So you need to take a look at what is being done on SSH/SFTP level.
I also fail to see any results in the output which means that no samplers have been successfully executed at all, check out jmeter.log file for any suspicious entries. You may also want to increase JMeter logging verbosity for the jsch library by adding the next line to log4j2.xml file:
<Logger name="com.jcraft.jsch" level="debug" />

Jmeter run 2 test plans sequentially command line

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

what if jmeter script has multiple graph listeners,In that case how can the results be stored in separate jtl files in non-gui mode?

i have a script with disabled aggregate graph listener. I ran the test in non GUI mode.
jmeter.bat -t test.jmx -l result.jtl
After running the script,I opened the result file in aggregate graph listener and i was able to view the graph.
Now i need to add more graphical listeners to my script.How can I get separate result files for the listeners in non-GUI mode ( all listeners disabled in order to optimize the script).
I am able to open the result file in the aggregate graph listener . But when i tired opening same file in Response Time Graph, I get message -
Unable to graph, not enough data
Results.jtl file looks like this -->
You do not need any listener in your test!! The below command is enough to create a result file for the test.
jmeter.bat -t test.jmx -l result.jtl
Once the result file is created, You just open them in any listener you want. the listener can you give the appropriate results - even the graph listeners.
You do NOT actually need any separate result file for each listener.

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