jmeter-cli
v1.0.1
Published
```markdown # JMeter CLI - Automated Performance Testing
Readme
# JMeter CLI - Automated Performance Testing
## Overview
The **JMeter CLI** is an automation tool designed to streamline the execution of JMeter scripts. It provides a command-line interface for running performance tests, managing configurations, and generating detailed test reports.
## Key Features
- Easy selection of test modules and sub-modules.
- Configurable user input for performance parameters like number of users, ramp-up period, and loop count.
- Automated result generation in CSV and HTML formats.
- Flexible directory structure for scripts, data files, and output files.
---
## Directory Structure
Here’s the organized structure of the JMeter CLI:
. ├── config.json # Configuration file for script paths and settings ├── datafiles/ # Directory containing input CSV files for JMeter scripts ├── jmeter-scripts/ # Directory containing JMeter (.jmx) scripts ├── output_files/ # Directory for storing test output (CSV/HTML) │ ├── CSV Output/ │ ├── HTML Output/ ├── run.mjs # Main CLI script for automation ├── docs/ # Learning and reference materials for JMeter
---
## Installation
Install the CLI globally via [npm](https://www.npmjs.com/) to make it available as a command-line tool:
```bash
npm install -g jmeter-cliConfiguration
The config.json file defines server settings, script paths, and data file mappings. Below is an example:
{
"server_ip": "<your_server_ip>",
"scripts": [
{
"name": "Client",
"scriptPath": "jmeter_scripts/client.jmx",
"csvFileName": "client.csv"
},
{
"name": "Corporate Events",
"subScripts": [
{
"name": "Equity Rights",
"scriptPath": "jmeter_scripts/corporate_events/equity_rights.jmx",
"csvFileName": "corporate_events/equity_rights.csv"
}
]
}
]
}server_ip: Replace with the IP of the target server.scriptPath: Path to the.jmxfile.csvFileName: Input file used by the script.
Usage
Run the CLI using the jmeter-cli command:
Start the CLI:
jmeter-cliFollow the prompts:
- Select a module: Choose a main test script.
- Select a sub-script (if applicable).
- Enter test parameters: Number of users, ramp-up period, and loop count.
The CLI runs the JMeter test and generates output files in the
output_files/directory.
Example
jmeter-cliPrompt Interaction:
- Select a module:
Report Dashboard - Select a sub-module:
Report Dashboard - PowerBI - Enter the number of users:
100 - Enter the ramp-up period:
60 - Enter the loop count:
10
Output:
- CSV file:
output_files/CSV Output/Report Dashboard/Report Dashboard - PowerBI_2025-01-12.csv - HTML file:
output_files/HTML Output/Report Dashboard/Report Dashboard - PowerBI_2025-01-12.html
Dependencies
This CLI uses the following packages:
- chalk: For styled terminal output.
- inquirer: For interactive prompts.
- cheerio: For parsing JMX files.
- ora: For loading spinners.
Install dependencies:
npm installContributing
We welcome contributions! If you have ideas or bug fixes, please submit a pull request or open an issue.
