What is the difference between unit and integration tests?
Reported in Skyscanner European engineering loops. Testing strategy question covering pyramid, mocks, and confidence vs speed.
Interview scenario
Often asked in Skyscanner loops at European offices (London, Berlin, Amsterdam, Paris, Stockholm, Dublin, and remote EU). Prepare a clear spoken answer plus key trade-offs.
Model answer
Try answering aloud first
Cover trade-offs, structure, and a concrete example before revealing the baseline response.
How to frame this at Skyscanner: Connect your answer to measurable impact, clarity of thought, and trade-offs the team cares about. Below is a strong baseline response you can adapt with your own project examples.
Unit tests verify one function or class in isolation—dependencies mocked. Fast, deterministic, pinpoint failures. Example: pricing logic with fake tax service.
Integration tests exercise real collaborators—database, HTTP client, message queue—often with test containers or in-memory equivalents. Slower but catch wiring, SQL, and schema mismatches unit tests miss.
Test pyramid: many unit, fewer integration, minimal end-to-end UI tests. Invert pyramid ("ice cream cone") when E2E dominates → flaky CI and slow feedback.
Discuss contract tests for microservices, snapshot testing for APIs, and when to use mocks vs fakes. Good teams measure coverage on critical paths, not arbitrary 100% line coverage.
Discussion
Comments (0)
Share how this question came up in your loop, or add tips for others preparing.
Log in to comment on this question.