Skip to main content
Test Automation

Test Pyramid

A testing strategy model with many unit tests at the base, fewer integration tests in the middle, and minimal E2E tests at the top.

Full definition

The test pyramid (coined by Mike Cohn) is a model for balancing different types of automated tests. It recommends:

Base — Unit Tests (70%)

  • Fast, cheap, isolated
  • Test individual functions/methods
  • Run in milliseconds
  • Developers write and maintain

Middle — Integration/API Tests (20%)

  • Test component interactions
  • Run in seconds
  • Good balance of speed and realism
  • QA and developers collaborate

Top — UI/E2E Tests (10%)

  • Test full user flows
  • Run in minutes
  • Most realistic but slowest and most brittle
  • QA typically owns

The anti-pattern is the 'ice cream cone' — lots of manual testing, some E2E automation, few unit tests. This is slow, expensive, and fragile.

Modern variations include the 'testing trophy' (Kent C. Dodds) which emphasizes integration tests, and the 'testing diamond' which puts more weight on API testing.

The key insight: move as many tests as possible down the pyramid for faster feedback and lower maintenance cost.

Learn more about test pyramid in practice

Automation track