InterviewStack.io LogoInterviewStack.io

Mocking, Stubbing, and Test Isolation Questions

Isolating the unit under test from its dependencies. Covers mocks, stubs, fakes, and spies, when to use test doubles versus real dependencies, and controlling external services and time. Includes designing for isolation so tests are fast, deterministic, and focused.

HardTechnical
48 practiced

As a technical lead, craft a stakeholder-facing proposal to reduce brittle, over-specified mocks in the test suite for a mission-critical service. Include a cost/benefit case, a phased technical plan, a rollback plan if the change causes problems, and the metrics you would use to measure success over the next quarter.

HardSystem Design
56 practiced

Your organization runs polyglot microservices across several languages, and two teams' independently hand-written mocks of the same internal service have already drifted out of sync with each other and with the real service. Propose an approach to keep mocking and stubbing consistent across languages so cross-service tests stay trustworthy as the organization grows, and explain how you would enforce it in CI.

HardSystem Design
58 practiced

Design a centralized mock-management platform for an organization with many teams. It must support versioned mock definitions, environment scoping, collaborative editing, test-time injection, and audit trails, and it must remain usable when a single test run spans dozens of microservices in parallel. Describe the APIs, data model, CI integration, authentication, and a migration strategy for existing consumers and providers.

That is every published Mocking, Stubbing, and Test Isolation question for Engineering Manager so far. Browse the other topics in this category, or practice this one interactively.