Bird
Raised Fist0
Postmantesting~20 mins

Mock server limitations in Postman - Practice Problems & Coding Challenges

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Challenge - 5 Problems
🎖️
Mock Server Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Mock Server Response Delays

Which of the following is a true limitation of Postman mock servers regarding response delays?

AMock servers can simulate delays but only up to a maximum of 10 seconds per response.
BMock servers can simulate any response delay precisely as configured in the mock settings.
CMock servers always respond instantly and cannot simulate network latency or delays.
DMock servers simulate delays randomly without any configuration option.
Attempts:
2 left
💡 Hint

Think about whether Postman mock servers can mimic slow network responses by default.

🧠 Conceptual
intermediate
2:00remaining
Mock Server Data Persistence

What is a key limitation of Postman mock servers related to data persistence?

AMock servers store all request data permanently and can be queried later for history.
BMock servers do not store any request or response data; each request is stateless and independent.
CMock servers store request data only for 24 hours before automatic deletion.
DMock servers store request data but only for requests with specific headers.
Attempts:
2 left
💡 Hint

Consider if mock servers keep track of previous requests or responses.

Predict Output
advanced
2:00remaining
Mock Server Response Matching Behavior

Given these two mock responses configured in Postman for the same endpoint but different query parameters, what response will the mock server return when called with ?type=admin?

Postman
1. Response A: matches requests with query param type=admin, returns status 200 with body {"role": "admin"}
2. Response B: matches requests with query param type=user, returns status 200 with body {"role": "user"}
AReturns status 200 with body {"role": "admin"}
BReturns status 200 with body {"role": "user"}
CReturns status 404 Not Found because query param type=admin is not supported
DReturns status 500 Internal Server Error due to ambiguous matching
Attempts:
2 left
💡 Hint

Think about how Postman mock servers match requests to responses based on query parameters.

assertion
advanced
2:00remaining
Assertion on Mock Server Response Headers

You want to write a test in Postman to assert that the mock server response includes the header Content-Type: application/json. Which assertion code snippet is correct?

Postman
pm.test("Content-Type is application/json", () => {
    // Your assertion here
});
Apm.expect(pm.response.headers.contentType).to.eql('application/json');
Bpm.expect(pm.response.headers['Content-Type']).to.equal('application/json');
Cpm.expect(pm.response.headers.getContentType()).to.equal('application/json');
Dpm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');
Attempts:
2 left
💡 Hint

Check the Postman API for how to get header values from the response.

framework
expert
2:00remaining
Limitations of Mock Server for Testing Authentication Flows

Which statement best describes a limitation of Postman mock servers when testing authentication flows that require dynamic token generation and validation?

AMock servers cannot execute server-side logic like token generation or validation; they only return static responses.
BMock servers can dynamically generate and validate tokens using pre-request scripts and environment variables.
CMock servers support OAuth2 token validation automatically without additional configuration.
DMock servers can simulate token expiration by setting response delays and status codes dynamically.
Attempts:
2 left
💡 Hint

Consider whether mock servers can run code or logic on the server side.

Practice

(1/5)
1. Which of the following is a limitation of Postman mock servers?
easy
A. They cannot execute real backend logic or database queries.
B. They can modify data in a real database.
C. They automatically update responses based on user input.
D. They provide unlimited concurrent connections without delay.

Solution

  1. Step 1: Understand what mock servers do

    Mock servers simulate API responses without running real backend code or accessing databases.
  2. Step 2: Identify the limitation

    Since mock servers only return fixed responses, they cannot execute real logic or database queries.
  3. Final Answer:

    They cannot execute real backend logic or database queries. -> Option A
  4. Quick Check:

    Mock servers = fixed responses only [OK]
Hint: Mock servers return fixed data, no real logic [OK]
Common Mistakes:
  • Thinking mock servers can update real databases
  • Assuming mock servers adapt responses dynamically
  • Believing mock servers handle unlimited traffic without limits
2. Which syntax correctly defines a mock server response in Postman?
easy
A. { "statusCode": 200, "content": "Success" }
B. { status: 200, body: { message: 'Success' } }
C. { "status": 200, "body": "{\"message\": \"Success\"}" }
D. { "code": 200, "response": "Success" }

Solution

  1. Step 1: Review Postman mock response format

    Postman mock responses use JSON with keys like "status" and a stringified JSON body.
  2. Step 2: Check each option

    { "status": 200, "body": "{\"message\": \"Success\"}" } uses correct keys and stringifies the body JSON properly. Others use incorrect keys or formats.
  3. Final Answer:

    { "status": 200, "body": "{\"message\": \"Success\"}" } -> Option C
  4. Quick Check:

    Correct keys and stringified body = { "status": 200, "body": "{\"message\": \"Success\"}" } [OK]
Hint: Use "status" and stringified JSON body keys [OK]
Common Mistakes:
  • Using unquoted keys in JSON
  • Not stringifying the body JSON
  • Using wrong key names like 'code' or 'statusCode'
3. Given this Postman mock server setup:
{ "status": 404, "body": "{\"error\": \"Not Found\"}" }

What will be the HTTP status code and response body when the mock server is called?
medium
A. Status 500 with body {"error": "Not Found"}
B. Status 200 with body {"error": "Not Found"}
C. Status 404 with empty body
D. Status 404 with body {"error": "Not Found"}

Solution

  1. Step 1: Read the mock response definition

    The mock response sets status to 404 and body to a JSON string with error message.
  2. Step 2: Determine the actual response

    When called, the mock server returns status 404 and the body parsed as JSON {"error": "Not Found"}.
  3. Final Answer:

    Status 404 with body {"error": "Not Found"} -> Option D
  4. Quick Check:

    Status and body match mock setup = Status 404 with body {"error": "Not Found"} [OK]
Hint: Status code matches mock's "status" field [OK]
Common Mistakes:
  • Assuming default 200 status code
  • Ignoring the body content
  • Confusing status 404 with 500
4. You created a Postman mock server but your app always receives the same response regardless of request parameters. What is the most likely cause?
medium
A. Mock servers return fixed responses and do not process request parameters.
B. Your request URL is incorrect and does not reach the mock server.
C. The mock server is down and returning cached responses.
D. You forgot to enable dynamic response scripting in the mock server.

Solution

  1. Step 1: Understand mock server behavior

    Postman mock servers return fixed responses based on saved examples; they do not run logic or read parameters.
  2. Step 2: Analyze the symptom

    Receiving the same response regardless of parameters matches fixed response behavior, not a connectivity or config issue.
  3. Final Answer:

    Mock servers return fixed responses and do not process request parameters. -> Option A
  4. Quick Check:

    Fixed response = no parameter processing [OK]
Hint: Mock servers ignore request parameters, always fixed response [OK]
Common Mistakes:
  • Assuming mock servers run backend logic
  • Blaming network or server downtime incorrectly
  • Expecting dynamic responses without scripting support
5. You want to test different API error scenarios using a Postman mock server. Which limitation should you consider when designing your tests?
hard
A. Mock servers can connect to real databases to fetch error details dynamically.
B. Mock servers cannot simulate dynamic errors based on request content; you must create separate examples for each error.
C. Mock servers automatically generate error responses based on request headers.
D. Mock servers can run custom scripts to change responses during runtime.

Solution

  1. Step 1: Recall mock server capabilities

    Postman mock servers return fixed responses from saved examples and do not run dynamic logic or scripts.
  2. Step 2: Understand error simulation approach

    To test different errors, you must create multiple saved examples with fixed error responses; dynamic error generation is not possible.
  3. Final Answer:

    Mock servers cannot simulate dynamic errors based on request content; you must create separate examples for each error. -> Option B
  4. Quick Check:

    Fixed examples needed for each error scenario [OK]
Hint: Create separate examples for each error scenario [OK]
Common Mistakes:
  • Expecting dynamic error generation from mock servers
  • Assuming mock servers connect to real databases
  • Thinking mock servers run runtime scripts