Load Testing

Run the same API test files under load with openpost perf, with thresholds that fail the build when latency or error rate regresses.

CLI

Basic Usage

openpost perf api-tests/tasks.api.yaml -c 20 -n 1000 -t "p95<250"

20 virtual users run the file's flow 1,000 times; fails if p95 latency is 250 ms or more

openpost perf api-tests/ --grep "List tasks" -c 50 -d 30s --ramp-up 5s --rps 200 -r html

One endpoint for 30 seconds, ramping up over 5 seconds, paced at 200 iterations per second

Each iteration runs the selected requests in order, so a load test exercises a real user flow
Requests marked once: true (login, setup) run once before the load and share their captures
Data rows rotate across iterations, so each virtual user sends different inputs
Captures still work inside an iteration: create → get → delete

Options

FlagDescription
-c, --concurrencyVirtual users running in parallel
-n, --iterationsTotal iterations across all users
-d, --durationRun for a time instead, e.g. 30s or 2m
--ramp-upStart users gradually over this time
--rpsPace iterations to this rate
--warmupIterations to run before measuring
-t, --thresholdPass/fail rule (repeatable)

All test flags also apply: --env, --env-file, --grep, --tag, -r, --report-dir and --json. Defaults can live in the file under perf:.

Thresholds

perf:
  concurrency: 10
  iterations: 200
  thresholds: { p95: "< 300", errorRate: "< 1%" }
requests:
  - name: List tasks
    url: /tasks
    perf:
      thresholds: { p95: "< 200" }     # per endpoint
MetricExample
p50 p90 p95 p99 max avgp95<300
ttfb_p95ttfb_p95<100
errorRateerrorRate<1%
errors / counterrors==0
rpsrps>=500
Any failed threshold makes the run exit with code 1
An errorRate < 1% threshold applies by default unless you set your own error threshold
A -t rule on the command line replaces a file threshold on the same metric
Failed runs print one sample failure per endpoint with the reason

Load Test Report

openpost load test HTML report

The HTML report from openpost perf -r html: thresholds, latency distribution, status codes, then throughput and p95 over time and per-endpoint metrics

Safety

Load-test only local, staging or explicitly approved targets. Never point a load test at production or a third-party API without permission from its owner.

Next

Ko-fi