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
67 practiced

For a payment flow that integrates with a third-party gateway, evaluate the trade-offs of three approaches: (A) end-to-end tests running against the gateway's sandbox, (B) integration tests that mock the gateway's responses, and (C) contract tests verifying the request and response schemas between your service and the gateway. Explain where contract tests sit relative to integration and end-to-end tests and what problem they solve that the other two do not, then recommend which of the three you would run on every pull request versus nightly, and justify your choice by risk and cost.

HardTechnical
107 practiced

Design an experiment, and the metrics you would use, to empirically validate whether a proposed test-pyramid ratio (for example, 70% unit, 20% integration, 10% end-to-end) actually improves delivery cadence and defect detection for your product. Include how you would form control versus experiment groups, the duration and sample size or statistical considerations involved, your success criteria, and how you would account for confounding variables.

HardTechnical
68 practiced

Your organization's regression coverage is 80% brittle UI tests that slow down CI and cause many false positives (an inverted pyramid, or 'ice-cream-cone' shape). Develop a migration plan to increase API-level testing while retaining business coverage. Include an inventory approach, criteria for selecting which UI tests to migrate first, an incremental rollout strategy, metrics to track that coverage parity is preserved, and risk-mitigation steps to avoid losing coverage during the transition.

MediumTechnical
58 practiced

As a Test Automation Engineer, describe where each of the following should execute in a CI/CD pipeline for a typical web application: unit tests, component tests, integration tests, UI (Selenium-style) tests, and performance tests. For each type, explain the trade-off between speed and confidence it represents, and suggest a gating strategy: which types should be able to block a merge, and which should run later without blocking developers.

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.

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.