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. Regarding Mocking, which of the following is a false statement?
- A. Over-mocking risks tests passing while real integrations are broken.
- B. Recording (record/playback) can generate stubs from real API traffic.
- C. Mocking eliminates the need for any integration testing forever.correct
- D. Stateful mocks can change behavior across a scenario, e.g., 404 then 200 after creation.
Why: The selected statement is false. The other options are accurate statements about Mocking.
2. Identify the INCORRECT statement about Mocking:
- A. Over-mocking risks tests passing while real integrations are broken.
- B. Service virtualization simulates dependent APIs so testing can proceed independently.
- C. A stub returns canned responses, while a mock additionally verifies how it was called.
- D. WireMock can only return instant, successful 200 responses.correct
Why: The selected statement is false. The other options are accurate statements about Mocking.
3. Which of the following statements about Mocking is FALSE?
- A. Simulating slow responses and timeouts tests client resilience.
- B. Recording (record/playback) can generate stubs from real API traffic.
- C. WireMock can only return instant, successful 200 responses.correct
- D. Stateful mocks can change behavior across a scenario, e.g., 404 then 200 after creation.
Why: The selected statement is false. The other options are accurate statements about Mocking.
4. Which statement about Mocking is NOT correct?
- A. Service virtualization simulates dependent APIs so testing can proceed independently.
- B. Recording (record/playback) can generate stubs from real API traffic.
- C. WireMock can only return instant, successful 200 responses.correct
- D. Stateful mocks can change behavior across a scenario, e.g., 404 then 200 after creation.
Why: The selected statement is false. The other options are accurate statements about Mocking.