Top 2 Techniques to Get JMeter Test Results in non-GUI mode
Stop fiddling around already. We feel you, so we'll give it up-the 2 easiest ways to get JMeter test results in non-GUI mode.
While running tests in non-GUI mode there is no access to listeners. But, results need to be analyzed, interpretations to be made.
That’s why we need to get the results-in any format.
2 Methods of Getting Test Results in non-GUI Mode
1. Using the JMeter Summariser
The first method is not related to *.jtl files, but it describes the simpliest way to get testing statistics while using non-GUI mode.
The Summariser is a special listener that only applies to non-GUI mode. It is controlled through JMeter properties that are contained in jmeter.properties. This file contains special section for summariser options. Let’s look into it.
# Summariser - Generate Summary Results - configuration (mainly applies to non-GUI mode)
# Define the following property to automatically start a summariser with that name
# (applies to non-GUI mode only)
# interval between summaries (in seconds) default 3 minutes
# Write messages to log file
# Write messages to System.out
So with the above properties enabled, a summary is sent every 180 seconds to both System.out and the log file. Note the summariser.name allows other summarisers to be developed and plugged in but I have not investigated that yet. The default summariser has been pretty useful. Here’s an example of what you get from the default summariser:
summary + 41 in 15.4s = 2.7/s Avg: 2234 Min: 383 Max: 6974 Err: 0 (0.00%)
summary + 57 in 21.5s = 2.6/s Avg: 2548 Min: 618 Max: 4528 Err: 0 (0.00%)
summary = 98 in 32.5s = 3.0/s Avg: 2416 Min: 383 Max: 6974 Err: 0 (0.00%)
summary + 108 in 21.8s = 5.0/s Avg: 1291 Min: 229 Max: 6317 Err: 0 (0.00%)
summary = 206 in 52.5s = 3.9/s Avg: 1827 Min: 229 Max: 6974 Err: 0 (0.00%)
The lines with “summary +” are incremental for the latest summariser period, the lines with “summary =” are cumulative. The above was with a summariser period of 20 secs, the actual periods can sometimes be longer than the specified period and the length of the very first period is somewhat random. You get the throughput statistics as well as average, min and max response times, and how many errors were detected (assuming your JMeter test plan has assertions to detect errors).
You may have noticed that one of the summariser properties was whether we wanted to send summariser output to the log file. Every JMeter run produces a log file, by default bin/JMeter.log. In either GUI or non-GUI mode, you can specify a different log file directly on the command line using the -j option. And as with most things in JMeter, the actual name of the log file is configurable through a property, in this case the log_file property.
So when you enable summariser.log=true as we did above, the summary lines we saw on stdout will also appear in the log file, with an identifying header such as “INFO – JMeter.reporters.Summariser:” to show their source (they will be mixed with other JMeter log information).
2. Using Graph listeners
After testing is complete, you can find the *.jtl file in the directory that was specified while starting the test with the following string:
jmeter -n -t D:\TestScripts\script.jmx -l D:\TestScripts\scriptresults.jtl
After that, run JMeter with GUI and add any listener to WorkBench.
Press button “Browse” and load *.jtl file to listener.
You will get this graph. It will be the same as if you used JMeter in GUI mode.
Good stuff huh.