These Postman interview questions cover what interviewers ask testers about day-to-day API work in Postman: request structure and body types, collections and workspaces, variable scopes, tests and chaining, authentication, mock servers, data-driven runs and Newman in CI. Code samples use Postman's pm scripting API.
1. What is Postman and what is it used for?
Postman is an API client and platform for sending HTTP requests, inspecting responses, writing test scripts, organising requests into collections, sharing them through workspaces, mocking APIs and running collections from the command line with Newman. Testers use it for exploratory API testing, quick regression collections and CI checks.
2. What are the parts of an HTTP request and response in Postman?
Request: method, URL with path and query parameters, headers, authorisation, and body. Response: status code and text, headers, body, cookies, response time and size. Postman shows each in its own tab.
3. What are the ways to send a request body?
raw (JSON, XML, text), form-data (key-value pairs and files, sent as multipart), x-www-form-urlencoded (simple key-value form posts), binary (a single file as the whole body) and GraphQL (query plus variables).
4. What is a collection and how do you create one?
A collection is a folder of saved requests with shared variables, authorisation, scripts and documentation. Create it from the sidebar (New → Collection), add requests and folders, and run it in the Collection Runner or with Newman.
5. Environment vs global vs collection variables?
Global variables are available everywhere in the workspace. Collection variables belong to one collection. Environment variables belong to the selected environment (QA, staging), so the same requests can run against different servers. When names clash, the narrower scope wins: local, then data, then environment, then collection, then global.
pm.environment.set("token", pm.response.json().token);
pm.collectionVariables.set("userId", 42);
pm.globals.set("runStart", Date.now());
6. Why are environments useful?
They let one collection run against QA, staging and production-like servers by switching the environment, without editing requests, and keep secrets out of the requests themselves.
7. How do you write tests in Postman? Give common assertions.
pm.test("status is 200", () => pm.response.to.have.status(200));
pm.test("responds fast", () => pm.expect(pm.response.responseTime).to.be.below(1000));
const body = pm.response.json();
pm.test("has users", () => pm.expect(body.data).to.be.an("array").that.is.not.empty);
pm.test("content type", () => pm.response.to.have.header("Content-Type"));More in Postman assertions and the Tests tab.
8. How do you extract a value from a response and use it in the next request?
In the Tests (post-response) script, parse the response and store the value in a variable, then reference it as {{token}} in later requests: pm.environment.set("token", pm.response.json().token);. This is request chaining.
9. What are pre-request scripts used for?
Code that runs before a request is sent: generating timestamps or random test data, computing signatures, refreshing an expired token, or setting variables the request needs.
10. How do you handle authentication in Postman?
Use the Authorization tab (Bearer token, Basic, API key, OAuth 2.0) at request, folder or collection level and inherit it in child requests; store tokens in environment variables and refresh them with a login request or pre-request script. See Postman authentication and tokens.
11. What is a Postman workspace?
A shared space for collections, environments, mock servers and APIs. Personal workspaces are private; team workspaces let a whole team work on the same collections with version history and comments.
12. How do you share collections?
Put them in a team workspace, share a link, export the collection and environment as JSON files, or keep the exported JSON in Git so changes are reviewed and Newman can run them in CI.
13. How do you create and use a mock server?
Create a mock server from a collection, add saved example responses to requests, and use the mock URL as the base URL. Postman returns the matching example, which lets front-end and test work continue before the real API exists.
14. What is the Collection Runner and data-driven testing?
The Collection Runner executes a collection or folder in order, with a chosen environment, a number of iterations and an optional CSV or JSON data file; each row becomes one iteration and its columns are available as variables like {{email}}.
15. What is Newman?
Postman's command-line runner: newman run collection.json -e qa.json -r cli,junit. It's how Postman collections run in Jenkins or GitHub Actions. See Postman and Newman in CI/CD.
16. How do you validate a JSON schema in Postman?
const schema = { type: "object", required: ["id", "email"],
properties: { id: { type: "integer" }, email: { type: "string" } } };
pm.test("matches schema", () => pm.response.to.have.jsonSchema(schema));
17. What are the limitations of Postman for test automation?
Large suites become hard to maintain as JavaScript snippets spread across requests, code reuse and version control are weaker than in a code framework, and complex data setup or database checks are awkward. Teams often use Postman for exploration and smoke checks and REST Assured or Playwright for full automated suites. See REST Assured vs Postman.
FAQs
Is Postman enough for API automation?
For exploration, smoke checks and small regression collections run with Newman, yes. Large, data-heavy suites are usually easier to maintain in a code framework such as REST Assured.