courier run
courier run sends requests and runs their tests.
courier run [options] [paths…]paths are .http files, folders or globs such as "api/**/*.http". With none, it runs the whole workspace, in sidebar order.
Variables and environments
Section titled “Variables and environments”| Option | What it does |
|---|---|
-e, --env <name> |
Use an environment, with its private file and $shared |
--var <name=value> |
Set a variable, overriding the environment. Repeatable |
--env-file <path> |
A JSON file of extra variables: {"name": "value"}, or env-file style with --env sections |
Secret references resolve the same way as in the app.
How requests run
Section titled “How requests run”| Option | Default | What it does |
|---|---|---|
--bail |
Stop after the first failure | |
-p, --parallel <n> |
1 | Run up to n requests at once. References still run first |
--data <file> |
A CSV or JSON file of rows. Each row runs the requests once, with its columns as variables | |
--iterations <n> |
1 | Run the requests this many times, or once per data row, whichever is more |
--delay <ms> |
0 | Wait between requests |
--ws-wait <ms> |
1000 | Keep WebSocket and SSE requests open this long. 0 skips WebSockets |
- Requests that others reference run first, once per run.
# @forceRefruns every time. - Scripts run in an embedded JavaScript engine with the same
client,request,responseandcourierAPI as the app, no network access, and a 5-second limit.client.globalvalues carry over to later requests in the run. - WebSocket requests connect, send their initial messages and listen. The response handler runs for each message.
- SSE requests listen until
--ws-waitends or the server closes the stream, and report the number of events. The handler runs once per event, with the event’s data asresponse.bodyand its name in thex-sse-eventheader. - gRPC requests run too, with
--timeoutas the deadline for streams.
Network
Section titled “Network”| Option | Default | What it does |
|---|---|---|
--timeout <ms> |
30000 | Per-request timeout |
-k, --insecure |
Don’t verify TLS certificates. Local dev servers only | |
--proxy <url> |
http://user:pass@host:port, socks5://host:port, system, or pac:<url-or-file> |
|
--cacert <path> |
Extra CA certificates to trust (PEM) | |
--cert <host=cert[,key]> |
A client certificate for a host. Repeatable. The host may be *.example.com |
|
--pfx <host=file> |
A PKCS#12 client certificate. The passphrase comes from COURIER_PFX_PASSPHRASE |
HTTPS_PROXY and NO_PROXY are read too.
Output
Section titled “Output”| Option | Default | What it does |
|---|---|---|
-r, --reporter <name> |
pretty |
pretty, json, junit, or html (a self-contained page) |
-o, --output <file> |
Write the report to a file instead of the terminal | |
-q, --quiet |
Only print failures and the summary | |
-v, --verbose |
Also print each response’s headers, body and script logs |
The pretty reporter prints a table with tests passed and failed, then each failure with its assertion message.
In all reports, values from the private env file, secret:// references, and --var values whose names look secret (such as token, apiKey or password) are replaced with ********. Other --var values are not masked.
Failures and exit codes
Section titled “Failures and exit codes”--fail-on <list> sets what counts as a failure: any of 4xx, 5xx, grpc (non-OK status) and tests, or none. The default is all four. Network errors always fail.
| Exit code | Meaning |
|---|---|
0 |
Everything passed |
1 |
Something failed |
2 |
A usage or setup error |