Skip to main content
hitspec includes a built-in stress testing engine. You do not need a separate tool — the same .http files you use for functional tests can drive load tests. This tutorial covers rate-based testing, virtual user mode, multi-phase profiles, and threshold-based pass/fail.

Prerequisites

Quick Start

The simplest way to stress test is with CLI flags:
This sends 10 requests per second for 30 seconds against the requests defined in api.http.
1

Create a test file for stress testing

Create stress.http with a simple request:
stress.http
Use {{$timestamp()}} or {{$uuid()}} to generate unique values on every request. This avoids caching effects and simulates realistic traffic.
2

Run a rate-based stress test

Rate mode sends a fixed number of requests per second:
This runs for 1 minute at 20 requests per second. hitspec distributes the load across all requests in the file.Output:
3

Run a virtual user stress test

VU mode simulates concurrent users, each sending requests sequentially:
This creates 10 virtual users, each waiting 500ms between requests. Unlike rate mode, VU mode models real user behavior where each user completes a request before starting the next.
4

Add ramp-up

Ramp up gradually to avoid overwhelming the server at startup:
The rate increases linearly from 0 to 50 rps over the first 30 seconds, then holds at 50 for the remaining 90 seconds.
5

Set pass/fail thresholds

Thresholds let you define success criteria. The test exits with code 1 if any threshold is violated:
Available threshold metrics:Combine multiple thresholds with commas.

Configuration File

For repeatable stress test configurations, define profiles in hitspec.yaml.

Rate-based Profile

hitspec.yaml
Run a specific profile:

Virtual User Profile

hitspec.yaml
VU mode is better for simulating real user behavior, where each user thinks between requests. Rate mode is better for measuring raw throughput.

Profile Strategies

Smoke Test

Verify the system handles minimal load without errors. Run this on every deploy.

Load Test

Sustained normal traffic levels. Verify performance under expected conditions.

Stress Test

Push beyond normal limits to find the breaking point.

Spike Test

Sudden traffic surge to test auto-scaling and recovery.

Per-Request Configuration

You can control how individual requests participate in stress tests using metadata:

Stress Testing in CI

Combine stress profiles with the GitHub Action for automated performance gates:
.github/workflows/stress.yml
See the CI/CD example for complete workflow patterns.

Reading the Output

A stress test run produces a summary like this:
If any threshold fails, the exit code is 1 and the failing threshold is marked:

Next Steps

Stress Testing Reference

Full reference for all stress testing options.

CI/CD Integration

Run stress tests in your CI pipeline.
Last modified on July 14, 2026