Mocking & Virtualization interview questions — Medium

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

What this covers

Mocking & Virtualization appears throughout API Testing interviews. At medium level, interviewers are typically checking that you have used it in practice: what you configured, what broke, and how you knew it worked. Work through these, then explain your answer out loud; the second part is what interviews actually test.

Other levels:Hard (100)Easy (99)

20 example questions

  1. 1. "Injecting failures to validate system resilience" — in Mocking, this describes which of the following?

    • A. Proxying.
    • B. Chaos testing.correct
    • C. Stub mapping.
    • D. Sandbox environment.

    Why: chaos testing: Injecting failures to validate system resilience.

  2. 2. "Choosing among overlapping stubs by priority value" — in Mocking, this describes which of the following?

    • A. Proxying.
    • B. Fault injection.
    • C. Priority matching.correct
    • D. Stub mapping.

    Why: priority matching: Choosing among overlapping stubs by priority value.

  3. 3. "WireMock rule matching a request to a canned response" — in Mocking, this describes which of the following?

    • A. Response templating.
    • B. Fault injection.
    • C. Proxying.
    • D. Stub mapping.correct

    Why: stub mapping: WireMock rule matching a request to a canned response.

  4. 4. "Provider-hosted fake environment for third-party APIs" — in Mocking, this describes which of the following?

    • A. Priority matching.
    • B. Proxying.
    • C. Sandbox environment.correct
    • D. Stub mapping.

    Why: sandbox environment: Provider-hosted fake environment for third-party APIs.

  5. 5. "Deliberately returning errors or malformed data to test resilience" — in Mocking, this describes which of the following?

    • A. Fault injection.correct
    • B. Response templating.
    • C. Proxying.
    • D. Priority matching.

    Why: fault injection: Deliberately returning errors or malformed data to test resilience.

  6. 6. "Building dynamic mock responses from request data" — in Mocking, this describes which of the following?

    • A. Priority matching.
    • B. Chaos testing.
    • C. Response templating.correct
    • D. Fault injection.

    Why: response templating: Building dynamic mock responses from request data.

  7. 7. Which of the following statements about Mocking is TRUE?

    • A. WireMock can only return instant, successful 200 responses.
    • B. Mocks and stubs are strictly identical concepts with no distinction.
    • C. Simulating timeouts is impossible with mock servers.
    • D. Service virtualization simulates dependent APIs so testing can proceed independently.correct

    Why: Mocks decouple teams from unavailable or costly dependencies.

  8. 8. Identify the accurate statement about Mocking:

    • A. Mocking eliminates the need for any integration testing forever.
    • B. Mocks and stubs are strictly identical concepts with no distinction.
    • C. Recorded stubs can never be edited after capture.
    • D. Service virtualization simulates dependent APIs so testing can proceed independently.correct

    Why: Mocks decouple teams from unavailable or costly dependencies.

  9. 9. Which statement correctly describes Mocking?

    • A. Service virtualization simulates dependent APIs so testing can proceed independently.correct
    • B. Mocks and stubs are strictly identical concepts with no distinction.
    • C. Mocking eliminates the need for any integration testing forever.
    • D. WireMock can only return instant, successful 200 responses.

    Why: Mocks decouple teams from unavailable or costly dependencies.

  10. 10. "Forwarding unmatched requests to a real backend" — in Mocking, this describes which of the following?

    • A. Chaos testing.
    • B. Fault injection.
    • C. Stub mapping.
    • D. Proxying.correct

    Why: proxying: Forwarding unmatched requests to a real backend.

  11. 11. In Mocking, which of the following is described as: "Choosing among overlapping stubs by priority value"?

    • A. Proxying.
    • B. Stub mapping.
    • C. Sandbox environment.
    • D. Priority matching.correct

    Why: priority matching: Choosing among overlapping stubs by priority value.

  12. 12. In Mocking, which of the following is described as: "Injecting failures to validate system resilience"?

    • A. Chaos testing.correct
    • B. Fault injection.
    • C. Priority matching.
    • D. Sandbox environment.

    Why: chaos testing: Injecting failures to validate system resilience.

  13. 13. In the context of Mocking, which of the following is a correct statement?

    • A. Mocking eliminates the need for any integration testing forever.
    • B. Simulating timeouts is impossible with mock servers.
    • C. Service virtualization simulates dependent APIs so testing can proceed independently.correct
    • D. Service virtualization requires all real dependencies to be online.

    Why: Mocks decouple teams from unavailable or costly dependencies.

  14. 14. Which Mocking concept matches this description: "Deliberately returning errors or malformed data to test resilience"?

    • A. Chaos testing.
    • B. Fault injection.correct
    • C. Response templating.
    • D. Stub mapping.

    Why: fault injection: Deliberately returning errors or malformed data to test resilience.

  15. 15. Which Mocking concept matches this description: "Injecting failures to validate system resilience"?

    • A. Priority matching.
    • B. Proxying.
    • C. Response templating.
    • D. Chaos testing.correct

    Why: chaos testing: Injecting failures to validate system resilience.

  16. 16. Which Mocking concept matches this description: "Provider-hosted fake environment for third-party APIs"?

    • A. Proxying.
    • B. Sandbox environment.correct
    • C. Stub mapping.
    • D. Response templating.

    Why: sandbox environment: Provider-hosted fake environment for third-party APIs.

  17. 17. In Mocking, which of the following is described as: "Building dynamic mock responses from request data"?

    • A. Sandbox environment.
    • B. Priority matching.
    • C. Response templating.correct
    • D. Fault injection.

    Why: response templating: Building dynamic mock responses from request data.

  18. 18. In Mocking, which of the following is described as: "Provider-hosted fake environment for third-party APIs"?

    • A. Response templating.
    • B. Chaos testing.
    • C. Fault injection.
    • D. Sandbox environment.correct

    Why: sandbox environment: Provider-hosted fake environment for third-party APIs.

  19. 19. In Mocking, which of the following is described as: "Deliberately returning errors or malformed data to test resilience"?

    • A. Stub mapping.
    • B. Sandbox environment.
    • C. Fault injection.correct
    • D. Proxying.

    Why: fault injection: Deliberately returning errors or malformed data to test resilience.

  20. 20. In Mocking, which of the following is described as: "WireMock rule matching a request to a canned response"?

    • A. Fault injection.
    • B. Stub mapping.correct
    • C. Sandbox environment.
    • D. Proxying.

    Why: stub mapping: WireMock rule matching a request to a canned response.

Related API Testing topics