JMeter in Command Line Mode: A Detailed Guide

JMeter is a performance testing tool which provides an option to run performance test in Non-GUI mode. It is helpful when you are running test scenarios causing heavy resource consumption such as large number of users, test run which might have high error rate etc. This article covers various facets of running JMeter in command line mode. Let’s start by knowing when it is helpful to run JMeter in Non-GUI mode.

When to user JMeter in command line mode?

  • You may not have GUI mode available in your test box.
  • Test you are running is resource intensive such as having large number of users, having high error rate, is complex.
  • JMeter is crashing in GUI mode.
  • You may want to get more requests per second out of JMeter

How to run JMeter in command line mode?
Running JMeter in command line/non-GUI mode is simple. You just have to run below command.

jmeter -n -t SampleTestPlan.jmx -l ResultFile.jtl

Below is the explanation of each parameter used in the command above.

-n: Specifies JMeter is to run in non-GUI mode
-t: Name of JMX file that contains the Test Plan
-l: Name of JTL file to log results to

These are the basic parameters used with this command. For detailed list of other commands, please visit official JMeter documentation.

View test result:
At the end of test run, a JTL file will be generated at the path you have defined in command above. Follow below steps to view test result from resultant JTL file.

  • Open JMeter in GUI mode.
  • Add any listener Eg. Aggregate Report.
  • Click Browse button of file name field in listener.
  • Locate JTL file.
  • You should be able to see result in listener now.

This is an introduction to how you can run JMeter in command line mode. Try it out and let us know how it goes. Also, don’t forget to share your learning in comments below.

Comments
  1. Mohan

Leave a Reply

Your email address will not be published. Required fields are marked *