Describe the test pyramid and how you apply it in practice.
- test pyramid
- test strategy
- test levels
Answer it first, then compare. Nothing here is saved or scored.
Model answer
The test pyramid has three layers: (1) Base (most tests): Unit tests. Fast, isolated, test individual functions/components. (2) Middle: Integration tests. Test component interactions, API endpoints, database queries. (3) Top (fewest tests): End-to-end tests. Full user flows through the UI. In practice: aim for 70% unit, 20% integration, 10% e2e. Unit tests give fast feedback, e2e tests give confidence. Common anti-pattern: the ice cream cone, lots of manual/e2e tests and few unit tests. This is slow and fragile. Invert it gradually by adding unit tests as you fix bugs.
What interviewers listen for
- Risk-based prioritisationYou can defend skipping coverage on a path because the risk maths supports it.
- Test design fluencyYou apply equivalence partitioning and decision tables to concrete inputs in real time.
- Metric judgmentYou distinguish between metrics that drive learning and metrics that drive theatre.
- Strategy under constraintYou can produce a defensible plan when the team has half the time and twice the scope.