Cheat sheets / Postman and Newman
Postman and Newman
Collections, variables, scripts and running them in CI.
Building blocks
- Collection and folders
- Group requests by feature; share them with the team.
- Environments and variables
- Keep base URLs and tokens per environment; use collection variables for shared values.
- Pre-request script
- Runs before the call: build a signature, set a timestamp or fetch a token.
- Tests tab
- Assertions after the call.
{{baseUrl}}/orderspm.test('status is 200', () => pm.response.to.have.status(200));Chaining and data
- Pass values forward
- Save a value from one response into a variable for the next request.
- Data-driven runs
- Run a collection against a CSV or JSON file, one iteration per row.
pm.environment.set('orderId', pm.response.json().id);In CI
- Newman
- The command-line runner for collections.
- Secrets
- Inject tokens from the CI secret store, never commit them in an environment file.
newman run collection.json -e env.json --reporters cli,junit