jmeter
Run performance and load tests
TLDR
Run a specific test plan in nongui mode
Run a test plan in nongui mode using a specific log file
Run a test plan in nongui mode using a specific proxy
Run a test plan in nongui mode using a specific JMeter property
SYNOPSIS
jmeter [options]
Example:
jmeter -n -t my_test_plan.jmx -l results.jtl -e -o report_dashboard
PARAMETERS
-n, --nongui
Specifies JMeter should run in non-GUI (command-line) mode. Essential for automated and large-scale test executions.
-t <test_plan.jmx>, --testfile <test_plan.jmx>
Specifies the path to the JMeter test plan (.jmx file) to be executed.
-l <results.jtl>, --logfile <results.jtl>
Specifies the path to the file where test results (e.g., sample data) will be saved. Usually a .jtl file.
-e, --report-generate-dashboard
Generates an HTML dashboard report after the test run. This option typically requires the `-o` option.
-o <output_folder>, --report-output <output_folder>
Specifies the output folder for the generated HTML dashboard report. This folder must be empty or non-existent.
-D <property=value>, --systemproperty <property=value>
Defines a Java system property. Can be used to override default JMeter behavior or configure plugins.
-J <property=value>, --jmeterproperty <property=value>
Defines a JMeter property. These properties are accessible within the test plan.
-h, --help
Displays help information and a list of available command-line options.
-v, --version
Displays the JMeter version information.
-s, --server
Starts JMeter in server mode, typically used for distributed testing.
-r, --remote_enable
Enables remote execution of tests on servers defined in `jmeter.properties`.
-R <host1,host2...>, --remote_hosts <host1,host2...>
Specifies a comma-separated list of remote JMeter server hosts to run the test on.
-X, --remoteexit
Exits the remote JMeter servers gracefully after the test completes when used with `-r`.
DESCRIPTION
Apache JMeter is a 100% pure Java application designed to load test functional behavior and measure performance. The `jmeter` command is the primary entry point for launching the JMeter application. It can operate in two main modes: a Graphical User Interface (GUI) mode for creating and debugging test plans, and a Non-GUI (command-line) mode for executing large-scale tests without the overhead of the GUI. JMeter can simulate heavy loads on servers, groups of servers, networks, or objects to test their strength and analyze overall performance under various load types. It supports a wide range of protocols and technologies, including Web (HTTP/HTTPS), FTP, Database via JDBC, LDAP, JMS, Mail (SMTP, POP3, IMAP), and more. Its extensible architecture allows for custom plugins and scripting to meet diverse testing needs.
CAVEATS
- Resource Intensive: JMeter, especially in GUI mode or with large test plans, can consume significant CPU and memory resources.
- JVM Tuning: Optimal performance often requires proper Java Virtual Machine (JVM) tuning, such as adjusting heap size for the JMeter process.
- Not a Browser: By default, JMeter is a protocol-level tool. It does not execute JavaScript, render HTML, or process CSS like a real web browser. Simulating complex browser-side actions might require additional configuration or plugins.
- Test Plan Complexity: Poorly designed or excessively complex test plans can lead to inaccurate results or inefficient resource consumption.
- Monitoring: It is crucial to monitor both the JMeter client/server and the target system's resources thoroughly during a load test for accurate analysis.
GUI VS. NON-GUI OPERATION
The `jmeter` command can launch JMeter in two distinct modes. The GUI mode (default when no options are provided) is primarily used for building, debugging, and analyzing test plans interactively. The Non-GUI mode (activated with the `-n` option) is optimized for executing tests, especially large-scale or automated runs, as it consumes fewer resources by omitting the graphical interface. It's a common best practice to design and debug test plans in GUI mode, then execute them in non-GUI mode.
AUTOMATED REPORT GENERATION
With the combination of `-e` and `-o` options in non-GUI mode, JMeter can automatically generate a comprehensive HTML dashboard report after the test execution. This report provides various metrics, graphs, and statistics, offering a quick overview of performance trends, errors, and throughput without needing to manually process the raw JTL results. This feature significantly streamlines result analysis.
EXTENSIBILITY VIA PLUGINS
JMeter's functionality can be significantly extended through a rich ecosystem of third-party and community-contributed plugins. These plugins add support for new protocols, listeners, samplers, functions, and more. Users can install plugins, often through the JMeter Plugins Manager, to tailor the tool to specific testing requirements, demonstrating the flexibility and adaptability of the `jmeter` command's underlying application.
HISTORY
Apache JMeter was originally developed by Stefano Mazzocchi of Apache Software Foundation in 1998, primarily for testing the performance of Apache JServ. It was later redesigned to become a general-purpose load testing tool capable of testing a wide range of services and protocols. JMeter became a Top-Level Apache Project in 2004 and has since seen continuous development and a growing community, expanding its capabilities to support modern web technologies and distributed testing.