Project | Web & API
API Testing with Postman and Newman
A versioned Postman collection run by Newman against a small commerce API in the repository: request chaining, checks that run on every response, order rules as CSV data rows, expected counts so a skipped folder cannot pass, 53 unit tests and a k6 smoke run.
On 28 Nov 2026: 53 unit tests passed, and Newman ran 34 requests with 72 assertions, none failed, every response valid against the OpenAPI contract and 14 of 14 documented responses seen.
Evidence checked 28 Nov 2026 | Scheduled CI run on main
On this page
Problem and purpose
A Postman collection is easy to start and easy to let rot: folders get skipped, data files get emptied, and a run with fewer checks still looks green. Here the runner knows how many requests and assertions to expect, so nothing can pass quietly. Building it found two real bugs in the API: a GET // request crashed the whole server, and a huge quantity made the order total null. Both are fixed and covered.
Architecture
npm run test:ci
├─ node:test unit tests (53)
└─ run-newman.js: start API on a free port
├─ main flow customers.csv 2 iterations, 26 requests, 56 assertions
├─ order rules invalid-orders.csv 8 iterations, 16 assertions
└─ every response validated against openapi.json; every documented response must be seenTechnology and tools
| Area | Tools |
|---|---|
| Collection | Postman: 13 requests in 4 folders plus one data-driven request for the order rules, with collection-level checks |
| Runner | Newman 6 from Node.js, with expected counts and OpenAPI validation of every response |
| Data | Two CSV files: customers for the main flow, one row per rule for the invalid orders |
| Unit tests | 53 tests with node:test: API behaviour, the OpenAPI validator, the Postman files, security, the HTML report |
| Extras | Redocly lint of the OpenAPI document, a k6 smoke run, HTML and JUnit reports |
Engineering decisions and approach
- Checks that every response must pass live at collection level, so a new request gets them too
- Later requests use the IDs and prices earlier ones returned (request chaining)
- A new order rule is a new CSV row, not a new request
- The runner checks the expected counts: a skipped folder or an empty CSV fails
- Unit tests reach what a collection cannot easily send, such as a 65 KB body
Test scope and execution approach
Project-specific checks and execution details documented in the repository:
- 72 Newman assertions per run, every one named with its case ID
- OpenAPI contract validation of every response and response coverage: 14 of 14 documented responses seen
- Security regression checks for credential handling and safe JSON headers
- k6 smoke run: 5 virtual users for 10 seconds with response and error thresholds
- Self-contained HTML report and a results table in every CI job summary
Results with dated evidence
Historical repository or workflow evidence
Scheduled CI run on main
On 28 Nov 2026: 53 unit tests passed, and Newman ran 34 requests with 72 assertions, none failed, every response valid against the OpenAPI contract and 14 of 14 documented responses seen.
Evidence checked: | Open dated evidence
Evidence explorer
Static screenshots are labelled as images; dated workflow links identify the execution evidence and its check date.
28 Nov 2026: 53 unit tests passed; Newman sent 34 requests with 72 assertions, none failed, no contract failures, and 14 of 14 documented responses were seen.
Static material from the public repository. The linked verification record was checked 2026-11-28; that date is not a screenshot capture date.
Dated workflow record
Evidence checked 2026-11-28. Open Scheduled CI run on main
Local setup and execution
npm ci
npm run lint:api # lint the OpenAPI contract
npm run test:ci # unit tests, then the collectionWorkflow and reports
Known limitations
- The API is built for this project, so its bugs and limits are the demo's
- One user at a time on localhost: nothing about load or real network behaviour
- npm audit lists development-only packages inside Newman that only a Newman release can fix
- The API is built for the project and the collection runs on localhost with one user at a time, which says nothing about load or real network behaviour.