The test pyramid, popularised by Mike Cohn in 2009, is a simple guide to balancing automated tests: many small, fast tests at the bottom, fewer broader tests above them and only a few slow end-to-end tests at the top. Teams that invert it, relying mostly on end-to-end tests, end up with slow, fragile suites nobody trusts.
Unit tests
Test business logic in isolation: calculations, validation and state changes. They run in milliseconds, pinpoint failures precisely and should make up most of the suite. Aim them at code with real logic, not trivial getters.
Integration and API tests
Test that components work together: an API endpoint with its database, a service with its message queue, your code with a third-party sandbox. They catch configuration and contract problems unit tests miss, and remain fast enough to run on every change.
End-to-end tests
Drive the real interface through critical journeys: sign-up, search, checkout and payment. Keep them few and stable, because each one is slow and touches everything.
Signs your balance is off
- The suite takes too long to run before every merge
- Tests fail at random and get re-run until they pass
- Bugs reach production in logic a unit test could have caught
- Nobody knows what a failing test is checking
Our engineers and consultants write about what they see in real projects. Have a question about your own systems?






