Run JMeter script from command line and create HTML Report

Below mentioned command will run your jmx file and create results in csv and HTML format

jmeter -n -t “Demo.jmx” -l “DemoResult.csv” -e -o “DemoHtmlReport”

Let's understand the above command

Prerequisite

  1. To run the above command you need to take the cmd to the directory in which JMeter is stored, and then navigate to bin directory where the jmeter.bat file is store. Then open cmd in this location and use the above command with some modification.
  2. -n → non-gui mode
  3. -t → Test plan file, when you execute some test plan from jMeter GUI it will create a jmx file , save that jmx file in the bin folder for now.
  4. “Demo.JMX” → Test plan that is created by JMeter UI.
  5. -l → JMeter Logs, this time it will create a CSV file
  6. -e -o are used to create HTML report from the same CSV file

For understanding first, try the below command it will run your JMX and also create a CSV file for the result, then remove the DemoResult.csv and again run with the previous command, it will create an HTML report.

jmeter -n -t “Demo.jmx” -l “DemoResult.csv”