Running Outry in CI
The same .outry (and .http) files you click through in the app can run as API tests on every push.
expect checks decide whether the job passes.
GitHub Actions
Section titled “GitHub Actions”name: API tests
on: [push, pull_request]
jobs: api: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4
# Start the service under test here (docker compose, a binary, …)
- name: Install outry run: | curl -fsSL https://raw.githubusercontent.com/1rowvy/outry/master/install.sh | sh echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Check request files run: outry check api --format github
- name: Run API tests run: outry run api --env ci --no-keyring --fail-fast env: OUTRY_TOKEN: ${{ secrets.API_TOKEN }}- Pin a version for reproducible builds:
OUTRY_VERSION=v0.2.0beforesh. - Secrets come from
OUTRY_<NAME>variables — see Secrets. --no-keyringskips the keychain lookup, which does not exist on runners anyway.- The update notice is disabled automatically when the
CIvariable is set.
Machine-readable output
Section titled “Machine-readable output”--json prints one JSON object per request (JSON Lines) instead of the human-readable report:
outry run api --json > results.jsonl{"file":"api/users/get.outry","name":"GetUser","passed":true,"outcome":{"kind":"request","request":{…},"response":{"status":200,…},"asserts":[…],"calls":[…],"saved":{}}}{"file":"api/users/bad.outry","name":"GetUser","passed":false,"error":"undefined variable(s): id"}A flow’s outcome has "kind":"flow" with checks, calls, saved and error.
Lint without sending
Section titled “Lint without sending”outry check checks the whole project without sending requests — one fast lint step: syntax, names of
called requests, their arguments, shapes and call cycles, every environment (requests whose only
excludes it, variables that are not defined in it), formatting, and — if there is a go.mod above the
project — routes in the Go code (as outry import go --check):
outry check # the project found from the current directoryoutry check api --env ci # one environment, secrets from the keychain / OUTRY_*outry check --format github # annotations on the PR diffapi/orders/create.outry:1:1: error: not formatted (`outry fmt`)api/orders/create.outry:7:22: error: variable `api_key` is not defined in staging, prodapi/orders/create.outry:9:13: error: `Seed` is limited to dev and cannot be called in prodmain.go:42:1: error: route DELETE /orders/{id} has no request (`outry import go` creates api/orders/delete.outry)12 files, 3 environments, 18 Go routes: 4 errors, 0 warningsDetails and flags: outry check.