API Test Template
A reusable Postman/Newman API testing template: real JWT auth flow, full CRUD coverage, CI, fork it and point it at your own API. Ships with a 47-assertion working example against a live public API.
Overview
A starter template for API test automation with Postman and Newman, so a collection runs identically from the CLI, CI, or the Postman GUI. It ships with a full, passing 47-assertion suite against dummyjson.com, a free public REST API with a real JWT auth flow, as a live worked example.
Using It
- Point it at your API: update the environment file's base URL and credentials.
- Replace the collection: edit the JSON directly or in the Postman app, keeping the folder structure: one folder per resource, auth first.
- Keep the patterns, not the specifics: chain state across requests with environment variables set in a test script and consumed later; assert invariants (
length === limit, computed totals) instead of hard-coded snapshots wherever the underlying data isn't fixed, so the suite doesn't go flaky as real data changes. - CI works as-is: the workflow doesn't reference dummyjson at all.
What the Example Demonstrates
- A real auth flow, not just CRUD: login returns an access/refresh token pair; a dedicated request exercises the refresh endpoint, and a token-gated route is tested both with and without credentials.
- Order-independent by design: the target API sets auth cookies as well as returning tokens in the body, and Newman's cookie jar persists across requests in a run. The "no token" test clears the jar in a pre-request script instead of relying on request order, and documents why, rather than shipping a test that only passes by accident of ordering.
- Assertions written against invariants, not snapshots: structural and behavioral checks where the API's data can change over time, direct checks (status codes, error text) where the behavior is genuinely fixed.
- Real variable chaining across requests, the way a Postman collection is meant to be used in practice.
Why a Template
The tedious part of API testing isn't writing assertions, it's the scaffolding: environment setup, auth chaining, CI wiring. This template has already made those decisions and proven they work, so forking it means starting from a working suite instead of an empty collection.