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.

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.

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
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.

EasyTechnical
57 practiced

You are testing a RESTful web application built from a React single-page application, a Node.js REST API, a PostgreSQL database, and an external payment gateway. For each test-pyramid tier (unit, integration, end-to-end), list four concrete example tests you would create, name a common tool or library for each example, and justify why each test belongs at that tier: what it verifies, and what it depends on.

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.

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.