InterviewStack.io LogoInterviewStack.io

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

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.

EasyTechnical
58 practiced

Explain the test pyramid concept. Describe its tiers (unit, integration, and end-to-end), the primary goal of each tier, and why the pyramid recommends many more low-level tests than high-level tests. For a typical web application, give concrete examples of test types and common tools at each tier (for instance, unit tests for helpers, integration tests for API-to-database interactions, end-to-end tests for a checkout flow), and briefly mention limitations or scenarios where the pyramid shape may not apply.

EasyTechnical
69 practiced

Given limited CI minutes and a team that wants fast developer feedback, decide which automated tests should run on every commit, which should run nightly, and which should be gated to pre-release or release pipelines. Provide your rationale and give examples at each level of the test pyramid. Then propose an approximate ratio (percentages or counts) of unit, integration, and end-to-end tests for a typical SaaS application, and state target CI run-times per layer on a pull request.

EasyTechnical
52 practiced

Why should a test suite typically contain far more unit tests than end-to-end tests? Give at least five reasons, spanning both technical factors (such as cost and feedback speed) and organizational factors (such as maintainability), and illustrate each reason with a short concrete example.

HardTechnical
61 practiced

Compare and contrast the classical test pyramid with the 'testing trophy' concept and other alternative testing models. Explain the trade-offs between them, and give three concrete production scenarios where deviating from a strict pyramid (favoring more integration or end-to-end tests) makes sense. Include the risks each scenario introduces and how you would mitigate them.

Unlock Full Question Bank

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

Sign in to Continue

Join thousands of developers preparing for their dream job.