Skip to main content

API tests in CI

API sessions replay from the standalone trq CLI exactly like web and mobile tests — same command, same reporters, same exit codes. Because API requests run server-side, they need no browser download at all, so they're the fastest thing in your suite.

Run one case

trq play health-check

Trq replays every request in health-check.trq in order, passing variables down the chain, prints per-request pass/fail, and exits 0 if everything passed or 1 if anything failed — a ready-made merge gate.

Choose an environment

Point the same case at a target with --env:

trq play create-user --env staging

Every {{env.*}} token resolves to that environment's values for the run.

A whole folder or suite

API sessions mix freely with web and mobile in a folder or a named suite:

trq play --suite smoke
trq play ./api # every .trq in a folder

Independent API sessions parallelize well — add --parallel --workers=N.

Reports & exit codes

The CLI emits the same machine-readable reporters as the rest of Trq:

trq play --suite smoke --reporter junit --out results.xml
trq play --suite smoke --reporter json --out results.json
  • junit — JUnit XML most CI systems render as a test report.
  • json — a structured { summary, results } for custom dashboards.

A run exits 0 on all-pass and 1 on any failure. See the CLI's CI guide for ready-to-copy GitHub Actions and Jenkins pipelines — API sessions drop straight in (you can skip the browser cache step for API-only runs).

No browser needed

Web and mobile runs fetch a browser or talk to an emulator; API sessions do neither. An API-only pipeline is just: install the binary, trq play, done.