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.

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.

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.

MediumTechnical
96 practiced

Explain how contract testing (for example, using Pact) can be used for a mobile client that consumes a REST API. Describe where the consumer's contracts should live, how provider validation works in the backend team's CI, and the trade-offs compared to relying on full end-to-end integration tests against a real or staged backend.

MediumTechnical
60 practiced

You must design the test-level balance for a consumer mobile banking app, where core user flows are critical and regulatory compliance is required. Propose an approximate mix (percentages or relative counts) of unit, integration, and end-to-end tests, and explain your reasoning. Discuss where manual testing is still required, which areas deserve heavier end-to-end automation, and how you would justify that investment's return to product and security stakeholders.

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.

Unlock Full Question Bank

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

Sign in to Continue

Join thousands of developers preparing for their dream job.