Skip to content
BENIBIX Learn

Test Pyramid

Development🧪 Testing & QualityTest Practices

Also known as Testing Pyramid, Test Automation Pyramid

Many small unit tests at the base. Only a few big end-to-end tests at the top.

Think of it like

Think of it like a pile of blocks. Lots of blocks at the bottom, and just a few at the top.

Example

Jack's app has 600 unit tests, 80 integration tests and 12 end-to-end tests. The whole suite runs in four minutes.

Why it matters

It keeps the suite fast and steady while still checking the whole app works.

Definition

The test pyramid is a guide for how many of each kind of test to write. The wide base is many small, fast unit tests. The middle is fewer integration tests. The narrow top is a few slow end-to-end tests. Tests near the top are slower and break more often, so you keep them few.
Many fast tests at the bottom, a few slow ones at the top.

Common mistake

Turning it upside down, with many slow browser tests and few unit tests. The suite gets slow and flaky.

Key takeaways

  1. 1
    Wide base. Many small, fast unit tests.
  2. 2
    Thin top. Few slow end-to-end tests.
  3. 3
    Cost rises up. Higher tests are slower to run.