JMeter can be run in two modes, with the more familiar GUI mode for designing tests. However, when running your load tests for production data gathering, it is recommended that it is run in non-GUI mode from a command line. This is in fact how load tests are run with RedLine13. But it is also possible to run JMeter in non-GUI mode on your local machine. There are instances where this is desirable, including debugging specialized or complex test architectures. In this article, we will show you how to run JMeter in non-GUI mode from the command line on your local machine.
Invoking a JMeter Test from the Command Line
The obvious prerequisite before invoking JMeter from the command line is that we need a JMX
file. We can use any existing test created from the JMeter user interface. From a terminal window on your local machine, the command to start JMeter in non-GUI takes the following form:
jmeter -n -t /path/test_plan.jmx -l /path/test_plan.jtl
There are three required parameters that must be passed:
-n
– This is a flag parameter that instructs JMeter not to load the user interface and start in non-GUI mode.-t
– The location of theJMX
file is specified along with the path to this location.-l
– We must also specify the desired name and location of theJTL
results file.
Results from the test will be saved to the location of the JTL
as specified. If your JMeter test plan is in a different location than the present working directory, you will need to specify the path to this file when passing the -t
and -l
parameters.
Use Cases for Running JMeter from the Command Line
As an intermediate step when creating tests, running a JMeter test from the local command line can be useful in a few situations. Some examples include:
- Real time feedback on errors and warnings.
- Rapid prototyping of complex tests.
- Debugging tests with external dependencies.
- Compare execution between different versions of JMeter.
Test runs started from the local command line can provide verbose output for debugging purposes, without the need to find this information inside log files. Errors and warnings may be addressable in real time as your test executes.
Did you know that RedLine13 offers a full-featured, time-limited free trial? Sign up now, and start testing today!