Run API tests in CI from a collection

The same collection you use in the app runs in a pipeline with one command. gostman run sends every request of a folder or export with its scripts, checks, extraction rules, cookies and OAuth 2 tokens, and needs only the single binary.

gostman run orders-api --env CI --var-from-env API_TOKEN --reporter junit --output report.xml

What the run gives you

  • Exit code 0 when every request and check passed, 1 when a check failed, 2 when the command or input is wrong and 3 when a request got no response
  • Text, JSON, JUnit and HTML reports
  • Data-driven runs from a CSV or JSON file, and parallel runs
  • Secrets passed from the job environment, with --redact to keep values out of reports
  • A GitHub Action and a Docker image, with recipes for GitLab CI and Jenkins

Starting from a Postman collection

If you run Postman collections with Newman today, import the collection in the app, save it to a folder, and point gostman run at that folder. The pipeline then needs only the gostman binary, not Node.js and npm.

Common pm.* script calls are rewritten to Gostman's script API on import, and the import summary lists the lines that need rewriting by hand.

Questions about API tests in CI

Is there a Newman alternative that doesn't need Node.js?

Yes. gostman run is a single binary with no Node.js or npm. It runs a collection with its scripts and checks, and there is a GitHub Action (kunalgoesbyken/gostman) and a Docker image (ghcr.io/kunalgoesbyken/gostman).

Can I run my Postman collection with it?

Yes, after one import: gostman import postman_collection.json --out orders-api writes a folder, and gostman run orders-api runs it. Commit the folder so the pipeline runs the same requests you edit in the app.

Which reports does it write?

Text in the job log, plus JUnit, JSON or HTML files with --reporter and --output. The GitHub Action can also write a job summary and a pull request comment.

How do I pass API tokens without committing them?

Keep the token in a CI secret and pass it with --var-from-env API_TOKEN. Add --redact so its value shows as {{API_TOKEN}} in every report.

Which exit codes does gostman run use?

0 when everything passed, 1 when a check failed, 2 when the command or input is wrong and 3 when a request got no response. A 4xx or 5xx status alone is not a failure, so add a check such as res.status equals 200.

CI recipesCommand line reference