Skip to content

Command line

reqjet runs the same files as the app, without the app. Environments, @variables, scripts, tests and chaining behave as they do in the app, so the requests you click through are the ones your pipeline checks. See Install Reqjet to install it.

reqjet --help describes every command, and reqjet run --help (or load, or mock) just one.

Terminal window
reqjet run api/ --env staging --junit results.xml # every request in the folder's .http files
reqjet run orders.reqjet-workspace --env staging # every folder in a saved workspace
reqjet run api/orders.http --var orderId=42 # one file, with a value for {{orderId}}
reqjet run ops/reindex.md --env dev --yes # a runbook, answering yes to confirmations
reqjet run ops/reindex.js --var prefix=orders # a script; --var also answers input()
reqjet run api/users.http --data users.csv # once per row of users.csv
reqjet load api/pets.http --name getPet -n 500 -c 20 # a quick load test
reqjet mock api/ --port 4010 # a mock server
Terminal window
reqjet run <path>... [options]

A path can be:

Path Runs
A folder Every request in its .http files, and in its sub-folders, in tree order.
A workspace (.reqjet-workspace) Each of its folders in turn. A folder it lists that isn’t there is an error, so a missing checkout can’t quietly leave tests out.
A .http file Every request in the file.
A runbook (.md) Its steps in order, stopping at the first that doesn’t finish.
A script (.js) The script, which sends requests by their # @name.

Runbooks and scripts only run when you name them, so running a folder never starts one by accident. WebSocket and server-sent event requests are skipped, as they stay open.

Option What it does
-e, --env <name> The environment from http-client.env.json and its private file.
--var <name=value> A value for {{name}}, over everything else. Repeat it for more values. It also answers runbook inputs and input() in scripts.
--yes Answers yes to confirmations. Without it, they’re asked on the terminal, or declined when there’s no one to ask.
--junit <file> Also writes the results as JUnit XML, which GitHub Actions, Azure DevOps, GitLab and Jenkins show as test results.
--summary <file> Also appends the results as Markdown: what failed and why, then a table per file.
--data <file> Runs each .http file once per row of a CSV or JSON file, with the row’s values as {{variables}}.
--update-snapshots Saves responses as the new snapshots instead of comparing with them. Without it, a missing snapshot fails.
--root <folder> Where to stop looking for env files. The default is the git repository’s root.
--proxy <url> Sends requests through this proxy (http://user:pass@host:port), or none to connect directly.
--proxy-bypass <hosts> Hosts that skip --proxy, such as "*.corp.local,10.*". Local addresses always do.
-v, --verbose Shows URLs, and the response of each failure.

A request passes when it gets a response and its tests pass. A runbook step passes when it finishes.

# @prompt values come from --var, or are asked on the terminal. In CI, where there’s no terminal, a request with a missing prompt value isn’t sent, and the output says to give it with --var.

Proxies: without --proxy, requests use HTTPS_PROXY, HTTP_PROXY and NO_PROXY when they’re set, and the operating system’s proxy otherwise.

Terminal window
reqjet load <file.http> [--name <request>] [options]

A quick load test of one request. It sends the request once normally, which gets OAuth tokens and runs its scripts, then sends it over and over, several at once, and reports requests per second, response time percentiles and failures. A send fails on no response, a 4xx or 5xx status, or a failed # @reqjet.assert.

Option What it does
--name <request> The request’s # @name or title. Not needed when the file has one request.
-n, --requests <count> How many to send. The default is 100.
-c, --concurrency <n> How many at once. The default is 10.
--duration <time> Keep sending for this long instead, such as 30s or 2m.
--max-p95 <ms> Fail unless 95% of requests are faster than this, such as 500 or 500ms.
--max-error-rate <%> Fail when more than this percentage of requests fail, such as 1.
--k6 <file> Don’t run it: write the same test, with its settings and thresholds, as a k6 script. - prints it.

-e, --var, --root and --proxy work as for reqjet run.

It’s a quick check of one endpoint, not a performance-testing suite. For multi-step scenarios, ramp-up or load from several machines, use a load-testing tool such as k6. Only load test a site you own or have permission to test.

Terminal window
reqjet mock <path>... [--port 4010] [-e <env>]

Serves canned responses on http://localhost:<port>, on this machine only, until you press Ctrl+C. A path can be:

Path Serves
A folder or .http file Each request’s method and path, answered with its saved snapshot. A {{variable}} in the path matches any value, and OpenAPI descriptions the files name (# @reqjet.openapi) are mocked too.
A workspace Each of its folders, as above.
An OpenAPI description Each operation, answered with its example, or with one made up from the schema.

-e picks the environment used to read base paths: with {{baseUrl}} set to https://host/api, the mock serves /api/….

Code Meaning
0 Everything passed. For reqjet load: the thresholds were met, or none were given and nothing failed.
1 Something failed.
2 A usage error, such as an unknown option or a missing file.
.github/workflows/api-tests.yml
name: API tests
on: [push]
jobs:
api:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Install reqjet
run: dotnet tool install -g Reqjet.Cli
- name: Run the API tests
run: reqjet run api/ --env staging --junit results.xml --summary "$GITHUB_STEP_SUMMARY"

--summary "$GITHUB_STEP_SUMMARY" shows the results on the run’s page. Secrets such as tokens can be given with --var from your CI system’s secret store, rather than committed in a private env file.