All subjects

API Testing · Interview subject

Postman Interview Questions

Collections, environments, scripts, chaining and Newman in CI.

51 questions

Quick interview answer

Environments for config, collection variables for chained IDs, pre-request scripts for auth tokens, pm.test assertions with schema validation, then run it in CI with Newman.

Detailed explanation

Keep no hardcoded values: baseUrl and credentials live in environments, dynamic ids in collection variables set via pm.collectionVariables.set(). A collection-level pre-request script fetches or refreshes the token once. Tests assert status, schema (tv4/ajv), business fields and response time. Newman runs the collection in the pipeline with a JUnit reporter so results appear with the rest of the suite.

javascript
1pm.test('order created', () => {
2 pm.response.to.have.status(201);
3 const body = pm.response.json();
4 pm.expect(body).to.have.property('orderId');
5 pm.collectionVariables.set('orderId', body.orderId);
6});

Real-world example

Newman running a 120-request collection became the smoke gate for every backend deploy.

Interview tip

Mention Newman + JUnit reporting — Postman without CI reads as manual API testing.

Next subjectREST Assured