0
0
Postmantesting~20 mins

Creating mock servers in Postman - Practice Exercises

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Mock Server Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Purpose of Mock Servers in API Testing

Why do testers use mock servers when testing APIs?

ATo speed up the actual API server by offloading requests
BTo simulate API responses when the real API is unavailable or incomplete
CTo permanently replace the real API in production environments
DTo automatically generate API documentation without manual input
Attempts:
2 left
💡 Hint

Think about situations when the real API is not ready but testing must continue.

Predict Output
intermediate
1:30remaining
Mock Server Response Matching

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?

Postman
GET /users/123 HTTP/1.1
Host: mockserver.postman.com
AAn empty response with status 204 No Content
BA 404 Not Found error because the mock server does not support GET requests
CA 500 Internal Server Error due to missing authentication
DThe predefined example response for GET /users/123
Attempts:
2 left
💡 Hint

Mock servers return the example response matching the request method and URL.

assertion
advanced
2:00remaining
Validating Mock Server Response Status Code

In Postman test scripts, which assertion correctly checks that the mock server response status code is 200?

Postman
pm.test("Status code is 200", () => {
    // Fill in assertion here
});
Apm.expect(pm.response.status).toBe(200);
Bpm.response.status === 200;
Cpm.response.to.have.status(200);
Dpm.response.statusCode(200);
Attempts:
2 left
💡 Hint

Use Postman's built-in assertion syntax for status codes.

🔧 Debug
advanced
1:30remaining
Troubleshooting Mock Server URL Mismatch

A tester created a mock server in Postman but receives 404 errors when sending requests. Which is the most likely cause?

AThe request URL path does not exactly match any example request path in the mock server
BThe mock server requires an API key but the request includes none
CThe mock server is offline and cannot respond to requests
DThe request method is POST but the mock server only supports GET
Attempts:
2 left
💡 Hint

Mock servers match requests by method and exact URL path.

framework
expert
2:30remaining
Configuring Postman Mock Server for Dynamic Responses

Which Postman feature allows a mock server to return different responses based on request parameters or headers?

AUsing multiple examples with matching request query parameters or headers to select the response
BWriting JavaScript code inside the mock server to dynamically generate responses
CEnabling the mock server's AI response generator to create varied outputs
DConfiguring the mock server to forward requests to the real API for dynamic data
Attempts:
2 left
💡 Hint

Postman mock servers select responses based on matching request details in examples.