Test Levels and the Test Pyramid Questions

How unit, integration, component, end-to-end and contract tests fit together and where each provides the most value. Covers the test pyramid and the competing shapes proposed against it (the testing trophy and the honeycomb), multi-layer test architecture, contract testing as the seam between services, choosing the right level to catch a given class of defect cheaply, and what to run per commit versus per release. Includes the cost and confidence trade-offs between fast low-level tests and slower, broader system tests. The scope is which level a test belongs at and why. Deciding how much to invest in testing and where to prioritize under time pressure is covered separately.

MediumTechnical
57 practiced

Many teams cite a '70/20/10' (unit/integration/end-to-end) or similar rule-of-thumb ratio for test distribution. Explain the rationale behind such ratios and the assumptions they make, and describe concrete scenarios where you would deviate from this guideline and why.

EasyTechnical
66 practiced

Explain the differences between unit tests, integration tests, and end-to-end tests. For each level, give two concrete examples (functions, modules, services, or UI flows), state when it should run (on a pull request, at merge, or nightly) and its typical execution speed, and discuss the typical maintenance cost and failure modes. Conclude with the concrete trade-offs between speed, coverage, and flakiness for a web application.

HardBehavioral
98 practiced

Tell me about a time you discovered a production bug that was caused by missing or insufficient tests. Using the STAR structure, describe the situation, the task you were responsible for, the actions you took to fix the bug and improve the tests or process (including which test level was missing and why), and the measurable result afterward.

HardTechnical
73 practiced

Discuss the trade-offs and return on investment between automating end-to-end UI tests versus API-level tests. Consider maintainability, flakiness, speed, coverage, and debugging ease, and how each should be used in release gating versus production monitoring. Conclude with a pragmatic hybrid approach and rules of thumb for deciding which user stories to automate at the UI level versus the API level.

MediumTechnical
57 practiced

You are refactoring a legacy user interface. Compare unit, integration, and end-to-end tests for this specific situation: their relative maintenance cost, execution speed, flakiness risk, and the class of regression each is most likely to catch. Explain how you would prioritize which of these to write first during a large refactor, then propose a test pyramid for a typical medium-sized frontend application.

Unlock Full Question Bank

Get access to all 20 Test Levels and the Test Pyramid interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.