Skip to content
Technology transformation expertise firm · ARDIANE Group Innovate, secure, succeed

Glossary

Test pyramid: definition, layers, competing shapes and criticisms

Domain

Engineering

In brief

The test pyramid is a model for distributing automated tests by level: many unit tests at the base, fewer tests as their scope widens, very few end-to-end tests at the top. The articles by Martin Fowler and Ham Vocke, on martinfowler.com, trace it back to Mike Cohn's book "Succeeding with Agile".

Page contents

Definition of the test pyramid

The test pyramid distributes a piece of software’s automated tests across several levels. In the article “Test Pyramid” (martinfowler.com, 1 May 2012, read on 12 November 2026), Martin Fowler sees it as a way of building a balanced portfolio of tests. Its essential point: many more low-level unit tests than high-level tests running through the graphical user interface.

A note added on 15 November 2017 traces its origin. The model became known through Mike Cohn’s book “Succeeding with Agile”, published in 2009, which calls it the “Test Automation Pyramid”. According to this note, Mike Cohn had drawn it in 2003 or 2004.

The layers and their names, from one author to another

In “The Practical Test Pyramid” (same website, 26 February 2018), Ham Vocke recalls the three layers of Mike Cohn’s diagram.

Layer Name used by Mike Cohn, according to Ham Vocke Martin Fowler’s reading
Base Unit tests The most numerous tests
Middle Service tests Tests running through a service layer, such as the API of a web application
Top User interface tests Tests through the graphical interface: brittle, expensive to write, slow to run

Ham Vocke takes two ideas from the diagram: write tests of different granularity, and write fewer of them the higher their level. He adds two rules: push each test as far down as possible, and fill in the lower level as soon as a high-level test reveals an error that went unnoticed further down.

In his view, unit tests form a safety net for code changes, the one that refactoring relies on. Neither article puts figures on the distribution.

Ice-cream cone, honeycomb, trophy: competing shapes and criticisms

Martin Fowler uses the image of the ice-cream cone for automation that runs mainly through the interface.

Ham Vocke considers the model too simplistic in hindsight: the term “service test” is poorly understood, and an interface can be checked by unit tests. Martin Fowler recalls the model’s assumption, that broad-scope tests are expensive, slow and brittle: if a team’s broad tests are fast, reliable and cheap to modify, he writes, lower-level tests are not needed.

In “On the Diverse And Fantastical Shapes of Testing” (2 June 2021), he comments on two other shapes, the honeycomb and the trophy, which call for few unit tests and mostly integration tests. He considers the debate pointless: their advocates give “unit test” a narrower meaning than the descriptions of the pyramid do.

Test pyramid, test strategy, business scenario: not to be confused

The pyramid distributes tests by level. The risks to cover are a matter of test strategy. What a suite is worth is measured differently: in common usage, mutation testing checks that the tests detect defects deliberately introduced into the code.

A behaviour-driven development scenario, written with the business, does not automatically belong at the top. Martin Fowler notes that teams confuse end-to-end tests, UI tests and customer-facing tests, three independent characteristics.

A festival ticketing system, layer by layer

Consider a festival’s ticketing system. The pricing rules (reduced rate, multi-day pass, booking fees) are checked case by case, through unit tests. A few tests go through the ordering API. A single journey crosses the interface: buying a ticket and receiving its confirmation. If this journey fails on a fee calculation, the team first writes the missing unit test.

The level to choose for each check is covered in our article on automated testing, the journeys at the top in the one on end-to-end testing. That leaves the overall distribution, which depends on the risks of each application: our software quality and testing page describes the test strategy that sets it.

FAQ

Frequently asked questions

Another question? Ask us

What is the test pyramid?

The test pyramid is a model for distributing a piece of software's automated tests by level. In his article "Test Pyramid", Martin Fowler gives its essential point: many more low-level unit tests than high-level tests running through the graphical user interface. Between these two levels, the model provides for tests that run through a service layer of the application.

Where does the test pyramid come from?

According to Martin Fowler's article "Test Pyramid", the test pyramid became known through Mike Cohn's book "Succeeding with Agile", published in 2009, where it is called the "Test Automation Pyramid". The same article states that Mike Cohn had drawn it in 2003 or 2004 and that Jason Huggins arrived at the same idea independently around 2006.

What is the ice-cream cone in testing?

The ice-cream cone refers, in common usage, to the inverse distribution of the test pyramid: most automated tests run through the user interface. Martin Fowler uses the image for suites built on recording and replaying on-screen interactions. Ham Vocke describes such a suite as a nightmare to maintain, far too slow to run.

What criticisms are levelled at the test pyramid?

Ham Vocke considers the test pyramid too simplistic in hindsight, and the names of its layers misleading. Martin Fowler points out that it assumes broad-scope tests are expensive, slow and brittle, an assumption with exceptions. Two competing shapes, the honeycomb and the trophy, mainly call for integration tests; Martin Fowler attributes the gap to different definitions of the unit test.

A project to bring to completion?

A first conversation is enough to understand your challenge, identify the right people and tell you frankly what we can bring.