Skip to main content

Test Pyramid

In Turkish
Test Piramidi
Updated 2 min read

Share this page

Send the link, quote the definition with a link back, or show it as a card on your own site.

https://softwaredictionary.org/terms/test-pyramid

In short

The test pyramid is a model for balancing automated tests: many fast unit tests, fewer integration tests, and only a few slow end-to-end tests at the top.

What is the test pyramid?

The test pyramid is a guideline for how to shape an automated test suite. It recommends a wide base of unit tests, a smaller middle layer of integration tests, and a narrow top of end-to-end tests. Mike Cohn popularized the idea in his 2009 book Succeeding with Agile, and it remains one of the most common ways teams discuss test strategy.

The shape follows a trade-off. Tests near the bottom are fast, cheap to write, and point to the exact line that broke, while tests near the top are slow, need a full environment, and are more likely to become flaky, but give more confidence that the whole system works. The practical rule is to push each test as low as it can go: if a unit test can catch a bug, don't write an end-to-end test for it, and keep the top layer for a handful of critical flows such as login and checkout.

It works like a food pyramid: plenty of staples at the bottom and only a little dessert at the top, because every layer has a role but the proportions matter. The opposite shape, sometimes called the ice cream cone, has mostly manual and end-to-end tests with few unit tests, which leads to slow, fragile pipelines. Some teams prefer alternative shapes, such as the testing trophy, which puts more weight on integration tests for frontend code.

The test pyramid is a rule of thumb about proportions and speed, not a fixed ratio such as 70/20/10, and it doesn't say that end-to-end tests are bad. It is also different from test coverage: coverage measures how much code the tests execute, while the pyramid describes how the tests are distributed across levels. A perfectly shaped suite can still leave important code untested.

Key takeaways

  • Write many unit tests, fewer integration tests, and only a few end-to-end tests.
  • Tests higher up are slower and more fragile but test more of the system at once.
  • Push each test to the lowest level that can catch the bug.
  • The inverted shape, often called the ice cream cone, is a common anti-pattern.
  • It is a guideline about balance, not a fixed ratio.

Example

The three layers of the pyramidtext
           /\
          /  \          End-to-end: few, slow, most realistic
         /----\
        /      \        Integration: some, real databases and APIs
       /--------\
      /          \      Unit: many, fast, isolated, cheap to run
     /------------\

Readers ask

Who created the test pyramid?

Mike Cohn described the test automation pyramid in his 2009 book Succeeding with Agile. It was later refined and popularized by other practitioners, including Martin Fowler's writing on the practical test pyramid.

What is the testing ice cream cone?

It is the upside-down pyramid: a suite dominated by manual and end-to-end tests with very few unit tests. It is considered an anti-pattern because such suites are slow, expensive to maintain, and often flaky.

Is the test pyramid still relevant?

Yes, as a way of thinking about cost and speed. Teams adapt the exact shape to their system, for example writing more integration tests for thin services whose main job is talking to a database.

See also

Spotted a mistake or something missing on this page?Suggest an edit

Read a random page
Open today's review
Switch to the dark theme
Read this page in Türkçe

More

Settings