Skip to content

Test Pyramid

Test portfolio should be shaped by the speed-realism trade-off: many fast isolated tests for rapid feedback, progressively fewer slower integrated tests for confidence, because feedback loops and maintenance costs compound over the development lifecycle.

Tension Addressed

Speed vs. Realism

Recognizable As

Project structures with unit/, integration/, e2e/ directories; CI pipelines with staged test suites; test count ratios showing many small tests and few large tests; discussions of "shifting left" or "testing at the right level"

Canonical Sources

Cohn, "Succeeding with Agile" (2009); Fowler, "TestPyramid" (2012); Humble & Farley, "Continuous Delivery" (2010)

Transfers To

Quality assurance in manufacturing (inspection at multiple stages); financial auditing (transaction-level vs. portfolio-level checks); security (defense in depth)

The pyramid shape emerges from economics: unit tests are cheap to write, fast to run, and precise in failure diagnosis. Integration and E2E tests are expensive on all three dimensions but catch classes of bugs that unit tests cannot. The optimal ratio varies by domain - UI-heavy applications may favor a "testing trophy" with more integration tests.