Why do testers use mock servers when testing APIs?
Think about situations when the real API is not ready but testing must continue.
Mock servers simulate API responses so testers can continue testing even if the real API is down or incomplete.
Given a Postman mock server with this example request and response setup:
{
"method": "GET",
"url": "/users/123"
}What response will the mock server return when a GET request is made to /users/123?
GET /users/123 HTTP/1.1 Host: mockserver.postman.com
Mock servers return the example response matching the request method and URL.
Mock servers return the predefined example response that matches the request method and URL path exactly.
In Postman test scripts, which assertion correctly checks that the mock server response status code is 200?
pm.test("Status code is 200", () => { // Fill in assertion here });
Use Postman's built-in assertion syntax for status codes.
The correct syntax is pm.response.to.have.status(200); which asserts the response status code is 200.
A tester created a mock server in Postman but receives 404 errors when sending requests. Which is the most likely cause?
Mock servers match requests by method and exact URL path.
If the request URL path does not exactly match any example request path, the mock server returns 404.
Which Postman feature allows a mock server to return different responses based on request parameters or headers?
Postman mock servers select responses based on matching request details in examples.
Postman mock servers use multiple examples with specific request query parameters or headers to return different responses dynamically.