Skip to interview prep
Apexed

56. When testing a service that calls a delivery provider, what should a test double replace?

EasyTesting & engineering practice

Technical
Show model answer

Replace the external network boundary with a controlled double so ordinary tests can exercise success, timeout and failure without placing real deliveries. Keep the service logic under test real.

A double proves behavior against the assumptions encoded in it. Add a separate contract or integration check against the supported provider interface, using its safe test environment where available, to catch a double that no longer matches reality.

What interviewers listen for

  • Replace external side effects
  • Keep business logic real
  • Verify the integration contract
When testing a service that calls a delivery provider, what should a test double replace — Software engineering interview question — Apexed