Test pyramid
The test pyramid is the testing-strategy heuristic that recommends many fast unit tests at the base, fewer integration tests in the middle, and very few slow end-to-end tests at the top. The pyramid shape reflects the cost/value ratio: unit tests catch defects cheaply; E2E tests catch a small but irreplaceable class of integration defects expensively.
The pyramid was popularised by Mike Cohn around 2009 and remains the dominant heuristic for test-suite composition. The inversion (the 'ice-cream cone' anti-pattern) is too few unit tests, too many E2E tests — typically 10x more expensive to run and maintain than a healthy pyramid. The proportions vary by domain but a rough target is 70% unit / 20% integration / 10% E2E by count, with the run-time roughly inverted (E2E may be slow but few; unit may be many but fast). Modern variants (the 'testing trophy' from Kent C. Dodds, emphasising integration tests for frontend code) adjust the proportions without rejecting the pyramid's core logic.
Discussed in our use-cases
ICP-targeted pages where test pyramid is part of the framing.
Related terms
- Test coverage
Test coverage is the percentage of code (typically measured by line, branch, or function) exercised by the test suite.
- Integration test
An integration test verifies that multiple components work together correctly — a service hitting a real database, two microservices communicating, a frontend talking to a real API.
- End-to-end testing
End-to-end (E2E) tests exercise an entire user journey across the full stack — UI, API, database, external services — as a real user would.