Mocking & Virtualization interview questions — Hard

100 hard-level Mocking & Virtualization questions from our API Testing bank, each with the correct answer and an explanation of why it is correct.

This topic slice is available to practise but is not yet part of our indexed set.

What this covers

Mocking & Virtualization appears throughout API Testing interviews. At hard level, interviewers are typically checking depth under pressure — edge cases, failure modes, performance characteristics, and the trade-offs you accepted. Work through these, then explain your answer out loud; the second part is what interviews actually test.

4 example questions

  1. 1. Regarding Mocking, which of the following is a false statement?

    • A. Stateful mocks can change behavior across a scenario, e.g., 404 then 200 after creation.
    • B. WireMock can only return instant, successful 200 responses.correct
    • C. Over-mocking risks tests passing while real integrations are broken.
    • D. Mocking third-party paid APIs in tests avoids cost and rate limits.

    Why: The selected statement is false. The other options are accurate statements about Mocking.

  2. 2. Identify the INCORRECT statement about Mocking:

    • A. Service virtualization simulates dependent APIs so testing can proceed independently.
    • B. Mocking eliminates the need for any integration testing forever.correct
    • C. Recording (record/playback) can generate stubs from real API traffic.
    • D. WireMock stubs HTTP endpoints with configurable responses, delays, and faults.

    Why: The selected statement is false. The other options are accurate statements about Mocking.

  3. 3. Which of the following statements about Mocking is FALSE?

    • A. WireMock can only return instant, successful 200 responses.correct
    • B. Over-mocking risks tests passing while real integrations are broken.
    • C. Mocking third-party paid APIs in tests avoids cost and rate limits.
    • D. WireMock stubs HTTP endpoints with configurable responses, delays, and faults.

    Why: The selected statement is false. The other options are accurate statements about Mocking.

  4. 4. Which statement about Mocking is NOT correct?

    • A. Stateful mocks can change behavior across a scenario, e.g., 404 then 200 after creation.
    • B. Mocks and stubs are strictly identical concepts with no distinction.correct
    • C. A stub returns canned responses, while a mock additionally verifies how it was called.
    • D. WireMock stubs HTTP endpoints with configurable responses, delays, and faults.

    Why: The selected statement is false. The other options are accurate statements about Mocking.

Related API Testing topics