0
0
Postmantesting~20 mins

Using mock server URL in Postman - Practice Problems & Coding Challenges

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
2:00remaining
What is the main purpose of using a mock server URL in API testing?

Choose the best explanation for why testers use a mock server URL during API testing.

ATo simulate API responses without calling the real server, enabling testing before backend is ready.
BTo permanently replace the real API in production for faster response times.
CTo encrypt API requests and responses for security during testing.
DTo automatically generate API documentation from live server data.
Attempts:
2 left
💡 Hint

Think about why you might want to test an API before the real backend is finished.

Predict Output
intermediate
2:00remaining
What response does this Postman mock server return?

Given this Postman mock server setup, what will be the response body when a GET request is sent to /user/123?

Postman
{
  "mock": {
    "endpoint": "/user/:id",
    "method": "GET",
    "response": {
      "status": 200,
      "body": {
        "id": "123",
        "name": "Alice",
        "role": "tester"
      }
    }
  }
}
A{"id": "123", "name": "Alice", "role": "tester"}
B{"id": ":id", "name": "Alice", "role": "tester"}
C{"error": "User not found"}
D404 Not Found
Attempts:
2 left
💡 Hint

Look at the mock response body and the URL parameter substitution.

locator
advanced
2:00remaining
Which Postman mock server URL correctly matches this request?

You have a mock server with base URL https://mockserver.postman.com. Which full URL correctly calls the mock for endpoint /orders/:orderId/items with orderId 789?

Ahttps://mockserver.postman.com/items/orders/789
Bhttps://mockserver.postman.com/orders/items/789
Chttps://mockserver.postman.com/orders/789/items
Dhttps://mockserver.postman.com/orders/:orderId/items
Attempts:
2 left
💡 Hint

Remember how URL path parameters are replaced in mock server URLs.

assertion
advanced
2:00remaining
Which assertion correctly verifies the mock server response status is 200?

In Postman test scripts, which code snippet correctly asserts that the response status code from the mock server is 200?

Apm.test('Status is 200', () => { pm.response.status === 200; });
Bpm.test('Status is 200', () => { pm.response.to.have.status(200); });
Cpm.test('Status is 200', () => { pm.response.statusCode(200); });
Dpm.test('Status is 200', () => { pm.response.statusCode === 200; });
Attempts:
2 left
💡 Hint

Check the correct Postman assertion syntax for status code.

🔧 Debug
expert
3:00remaining
Why does this Postman mock server test fail?

Given this test script for a mock server response:

pm.test('Response has userId 101', () => {
  pm.expect(pm.response.json().userId).to.eql(101);
});

The mock server response body is {"userId": "101", "name": "Bob"}. Why does the test fail?

ABecause pm.expect is not a valid Postman function.
BBecause the mock server does not support JSON responses.
CBecause the test script syntax is incorrect and missing a closing bracket.
DBecause the response userId is a string "101", but the test expects a number 101.
Attempts:
2 left
💡 Hint

Check the data types of the expected and actual values in the assertion.