Integration Testing vs Unit Testing
The distinction between testing units in isolation with mocked dependencies versus testing how multiple real components work together, and the tradeoffs of each.
Unit tests and integration tests sit at different points along a spectrum trading off isolation and speed against realism and confidence, and understanding when each is the right tool — rather than treating one as simply 'better' than the other — is a genuinely important architectural judgment call that interviewers use to gauge testing maturity beyond just syntax knowledge.
Unit testing is like a car manufacturer bench-testing each individual part (the engine, the brakes, the transmission) separately on isolated test rigs to confirm each one works correctly on its own. Integration testing is actually bolting several of those real parts together into a partially assembled vehicle and driving it around a test track, confirming the engine's real power actually reaches the real wheels correctly through the real transmission, not just that each part individually performed fine in isolation.