HttpHammer 1.0.1
See the version list below for details.
dotnet tool install --global HttpHammer --version 1.0.1
dotnet new tool-manifest
dotnet tool install --local HttpHammer --version 1.0.1
#tool dotnet:?package=HttpHammer&version=1.0.1
nuke :add-package HttpHammer --version 1.0.1
HttpHammer
A command line tool for load testing and benchmarking HTTP APIs. HttpHammer allows you to define requests in a YAML configuration file and execute them with configurable concurrency and volume.
Features
- Define API requests in a simple YAML configuration format
- Support for warmup requests to prepare your test environment
- Concurrent request execution with configurable parallelism
- Variable substitution to dynamically modify requests
- Extract values from responses and use them in subsequent requests
- Detailed performance metrics and reporting
- Support for multiple HTTP methods (GET, POST, PUT, etc.)
- Header and body customization for requests
Installation
HttpHammer is distributed as a .NET Tool. You can install it globally using the .NET CLI:
dotnet tool install -g HttpHammer
Or update to the latest version:
dotnet tool update -g HttpHammer
Requirements
- .NET 9.0 or later
Usage
httphammer --file plan.yaml
If you don't specify a file, you will be prompted to enter the path to your YAML configuration file.
Command Line Options
--file
,-f
- Path to the plan YAML configuration file--debug
,-d
- Enable debug logging to the console--verbose
,-v
- Enable verbose logging to the console
Configuration Format
HttpHammer uses YAML files to define the execution plan. Here's a basic example:
variables:
baseUrl: http://localhost:5200
apiVersion: 1.0
warmup:
authenticate:
name: Authenticate
description: Request token with password-grant
method: POST
url: ${baseUrl}/auth
headers:
Content-Type: application/x-www-form-urlencoded
body: "grant_type=password&username=admin&password=admin"
response:
status_code: 200
content:
access_token: =>{access_token}
requests:
get-data:
name: Get Data
description: Fetch data from the API
concurrent_connections: 10
max_requests: 100
method: GET
url: ${baseUrl}/api/data
headers:
Authorization: Bearer ${access_token}
Configuration Sections
Variables
Global variables that can be used throughout the configuration file.
variables:
baseUrl: http://localhost:5200
apiKey: your-api-key
The application also dynamically adds extracted variables from the warmup requests and the following variables during execution.
Field | Description |
---|---|
request |
The current request number. |
timestamp |
The timestamp when the test started in unix timestamp format. |
Warmup
Requests that are executed sequentially before the main test starts. Useful for authentication, setting up test data or simply warming up the API server.
warmup:
request-name:
name: Human readable name
description: Description of what the request does
method: HTTP method (GET, POST, etc.)
url: URL for the request, can use variables like ${baseUrl}
max_requests: Maximum number of requests to send (default: 1)
headers:
Header-Name: Header value
body: Request body (string or JSON)
response:
status_code: Expected status code (default: 200)
content:
json_field: =>{variable_name} # Extract json_filed value and store in variable_name
headers:
header-name: =>{variable_name} # Extract header-name value and store in variable_name
Requests
The main requests that will be executed concurrently.
requests:
request-name:
name: Human readable name
description: Description of what the request does
concurrent_connections: Number of concurrent connections (default: 10)
max_requests: Maximum number of requests to send (default: 100)
method: HTTP method (GET, POST, etc.)
url: URL for the request, can use variables like ${baseUrl}
headers:
Header-Name: Header value
body: Request body (string or JSON)
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.