Newman: Running Collections via CLI
The Collection Runner is great, but it needs a human sitting in front of the Postman desktop app clicking Run. Real testing teams need the RecipeBox test suite to run automatically — every time someone pushes code, on a schedule overnight, or as a gate before a deploy — with no one clicking anything. Newman is Postman's official command-line collection runner: it takes the exact same collection and environment files you've been building in the desktop app and runs them from a terminal, which is what makes them usable in a CI pipeline.
Installing Newman
Newman is a Node.js package, installed globally with npm:
npm install -g newman
Confirm it installed correctly:
newman -v
That's the entire setup — no separate download, no license, nothing tied to your Postman account. Anywhere Node.js runs (your laptop, a Jenkins agent, a GitHub Actions runner, a Docker container) can run Newman.
Exporting the Collection and Environment
Newman doesn't read from your Postman account directly — it runs from JSON files exported to disk. Export both:
- Right-click
RecipeBox APIin the sidebar → Export → save asrecipebox-collection.json. - Open the
dev-environmentenvironment → click the "..." menu (or the download icon) → Export → save asdev-environment.json. - Commit both files into the project's repository (e.g. under a
postman/folder) so CI can check them out along with the code.
Running a Collection with Newman
From the folder containing both exported files:
newman run recipebox-collection.json -e dev-environment.json
Newman fires every request in recipebox-collection.json, in order, against
{{baseUrl}} and the other variables defined in dev-environment.json —
functionally identical to a Collection Runner pass in the desktop app, but from a terminal with no
UI at all. Add a data file the same way the Runner used one:
newman run recipebox-collection.json -e dev-environment.json -d search-queries.csv
Reading Newman's Terminal Output
Newman prints every request it sends, every test that ran against it, and a summary table at the end:
RecipeBox API
→ Login
POST {{baseUrl}}/auth/login [200 OK, 512B, 340ms]
✓ login succeeded and returned a token
→ Get Recipe by ID
GET {{baseUrl}}/recipes/42 [200 OK, 812B, 210ms]
✓ status code is 200
✗ response matches the Recipe schema
AssertionError: expected {...} to match json-schema
▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪
executed failed
iterations 1 0
requests 2 0
test-scripts 2 0
prerequest-scripts 1 0
assertions 3 1
total run duration: 1.1s
The bottom summary table is the number that matters for automation: 1 failed assertion means the whole run exits with a non-zero exit code. That single detail is what lets a CI pipeline treat a Postman test failure exactly like a failed unit test.
Why This Matters: Postman Tests in CI
Because Newman is a plain CLI command with a meaningful exit code (0 on all tests
passing, non-zero if anything failed), any CI system can run it as a build step and fail the build
automatically:
# Example step in a Jenkins / GitHub Actions pipeline
npm install -g newman
newman run recipebox-collection.json -e dev-environment.json
In GitHub Actions this is literally one step in a workflow YAML file; in Jenkins it's one line in a pipeline stage. Either way, the same RecipeBox assertions you wrote and clicked through manually in Postman now run automatically on every pull request or every merge to main — the tests didn't change at all, only how and when they run.
--reporters cli,junit,html to produce a JUnit XML report — most CI systems (Jenkins included) can parse JUnit XML natively to show pass/fail trends over time, not just the raw terminal output from a single run.