What is Test Pyramid?
The test pyramid is a testing strategy that prescribes many fast, cheap unit tests at the base, fewer integration tests in the middle, and a small number of slow, expensive end-to-end tests at the top.
The test pyramid is a testing strategy that prescribes many fast, cheap unit tests at the base, fewer integration tests in the middle, and a small number of slow, expensive end-to-end tests at the top. Coined by Mike Cohn, the pyramid shape reflects the ideal ratio: many small tests, few large tests.
Layers: Unit tests (test individual functions/classes in isolation, milliseconds, thousands of them), Integration tests (test component interactions, seconds, hundreds), End-to-end tests (test full user flows through the real system, minutes, dozens), and Manual/exploratory tests (human verification, rare, for subjective quality).
The anti-pattern is the "ice cream cone" — many E2E tests, few unit tests. This creates slow, flaky, expensive test suites that developers avoid running. The test pyramid keeps the feedback loop fast.
Why It Matters
A properly shaped test pyramid gives developers confidence to refactor and ship quickly. Fast unit tests catch most bugs in seconds. Slow E2E tests verify critical paths without becoming a bottleneck.
Frequently Asked Questions
What is the test pyramid?
A testing strategy: many fast unit tests (base), fewer integration tests (middle), few slow E2E tests (top). The pyramid shape keeps the feedback loop fast while maintaining coverage.
What ratio should the test pyramid follow?
No universal ratio, but a common guideline: 70% unit, 20% integration, 10% E2E. The key principle: if a bug can be caught by a unit test, don't write an integration test for it.
Related Terms
Need Expert Help?
Richard Ewing is a Product Economist and AI Capital Auditor. He helps companies translate technical complexity into financial clarity.
Book Advisory Call →