JMeter Quick Hacks

  1. Add JMeter application to PATH variable

    1. Windows machine

      1. Open the System Properties window and click the Environment Variables button.
      2. In the System variables section, locate the Path variable, select it, and click Edit.
      3. In the Edit Environment Variable window, click New and add the full path to the bin directory where JMeter is located (e.g., C:\apache-jmeter\bin).
    2. Mac/Linux machine

      1. Open a terminal window.

      2. Edit your shell profile file (depending on the shell you're using, this could be .bashrc, .bash_profile, .zshrc, etc.).

        For example, if you're using Bash, run:
        nano ~/.bash_profile

        If you're using Zsh, run:
        nano ~/.zshrc

      3. Add the following line to the end of the file, replacing the path with your JMeter bin directory:

export PATH=$PATH:/opt/apache-jmeter/bin

  1. Save the file and exit


  1. Increase Heap Size of JMeter Application

    1. For windows

Modify the below command the jmeter.bat file in "jmeter/bin" folder
Ex - set HEAP=-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m

  1. For Mac/Linux -

Modify the below command the jmeter file in "jmeter/bin" folder
Ex -"${HEAP:="-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m"}"

  1. Running JMeter in non GUI mode

To run JMeter in non-GUI mode, execute the following command in the terminal: jmeter -n -t <path_to_your_test_plan>.jmx -l <path_to_results>.jtl -e -o <path_to_report_output>

For example: jmeter -n -t  jmetertestfile.jmx -l logging.jtl -e -o htmlreport


  1. Create HTML report file in Non GUI mode using results file

To generate an HTML report from the results file, run the following command in the terminal: jmeter -g <path_to_results>.jtl-o <path_to_report_output>

For example: jmeter -g logging.jtl -o htmlreport


  1. Create Aggregate report file in Non GUI mode

    1. Install JMeter command line tool from URL - “https://jmeter-plugins.org/wiki/JMeterPluginsCMD/

    2. Use the below command to generate an aggregate report in csv using the below command.

      JMeterPluginsCMD.bat --generate-csv test.csv --input-jtl results.jtl --plugin-type ResponseTimesOverTime



Comments