---
title: "The Software Testing Pyramid: Unit, Integration, and E2E Testing Explained"
description: "The software testing pyramid puts fast unit tests at the base and few end-to-end tests at the top. What each layer covers and how AI changes the balance."
canonical: "https://momentic.ai/blog/software-testing-pyramid-guide"
last-updated: "2026-09-17T16:06:49Z"
---

# The Software Testing Pyramid: Unit, Integration, and E2E Testing Explained

URL: https://momentic.ai/blog/software-testing-pyramid-guide

[blog](/blog) [/ resources](/blog/category/resources)  / software-testing-pyramid-guide

Resources

Your guide to the software testing pyramid and how to adapt it to the needs of modern development teams, tips on test balance, AI tools, and more.

Wei-Wei Wu

CEO, Momentic

The software testing pyramid is a model that tells you how to distribute automated tests: many fast unit tests at the base, fewer integration tests in the middle, and a small number of end-to-end (E2E) tests at the top. The model still holds in 2026, but AI test tools change how much E2E coverage a team can afford.

The software testing pyramid is one of the most fundamental concepts in QA testing, and has been for a long time.

So, is it still relevant?

Short answer: absolutely, but given the scale and speed at which modern software teams need to test, you may have to adapt your approach to it a little to maximize its benefits. [Traditional automation plus retained manual involvement](https://momentic.ai/blog/automated-vs-manual-testing) in E2E tests is not efficient enough anymore.

Here’s what you need to know, and how to rethink your approach to the software testing pyramid in 2026 and beyond.

## What Is the Software Testing Pyramid?

The software testing pyramid is a straightforward model for automated testing. It shows you how much (proportionally) of each type of test your team should be doing for effective QA. It consists of:

- A large base of unit tests
- A moderate layer of integration tests
- A small number of end-to-end (E2E) tests

Tests closer to the base are faster and simpler, and therefore cheaper and easier to maintain. Tests at the top are slower, more complex, and more expensive.

## Why the Software Testing Pyramid Matters

The software testing pyramid matters because it keeps the maintenance cost and the feedback time of a test suite under control. Fast, cheap tests catch most bugs, and the slow, expensive tests cover only what the lower layers cannot.

Practically speaking, however, it is very easy for commercial pressures to skew even the most experienced engineering team’s approach to software testing. Often, teams end up with too much top-level validation (E2E tests) and not enough at the bottom; this results in a high maintenance burden and long feedback loops that delay releases.

The software testing pyramid addresses this by encouraging a balanced, systemic approach to functional testing:

- Bugs are caught early (unit tests)
- Components work together correctly (integration tests)
- User journeys are validated (E2E tests)

Fewer bugs are carried up to your E2E tests, so your team spends less time finding and fixing an unidentified error in what was supposed to be a final-stage check.

## The Layers of the Software Testing Pyramid

The pyramid has three layers: unit tests at the base, integration tests in the middle, and E2E tests at the top. Each layer tests a wider scope than the one below it, and each layer is slower and more expensive to run and to maintain.

| Layer | What it tests | Speed | Typical share | Tools |
| --- | --- | --- | --- | --- |
| Unit | One function, method or class in isolation | Milliseconds | About 70% | Jest, Vitest, pytest, JUnit, XCTest |
| Integration | Two or more components together: API and database, service and service | Seconds | About 20% | Supertest, Testcontainers, Pact |
| End-to-end (E2E) | A full user journey through the real UI | Minutes | About 10% | Momentic, Playwright, Cypress, Selenium, Appium |

### Base Layer: Unit Testing

[Unit tests](https://momentic.ai/blog/types-of-software-testing-glossary) focus on the smallest pieces of code, typically individual functions or methods. They’re a quick, cheap way to validate that each unit behaves as expected when run by itself.

Unit tests should be isolated; you’re identifying issues with the code itself, not with its interaction with any other function.

For example:

- Testing a function that calculates a discount
- Verifying a utility method formats dates correctly
- Checking a validation function handles edge cases

This helps you catch bugs before they propagate, and encourages faster debugging due to isolated failures, clean, modular code design, and confident refactoring.

### Middle Layer: Integration Testing

[Integration tests](https://momentic.ai/blog/types-of-software-testing-glossary) verify that different parts of your system work together correctly. Instead of testing isolated units, they focus on interactions between components.

For example:

- API endpoints interacting with a database
- Services communicating with each other
- Frontend components calling backend APIs

Integration tests help you identify data flow issues, misconfigured dependencies, API contract mismatches, and data interaction problems.

They’re more complex and generally need more maintenance than unit tests, so you should conduct fewer of them, but ignore them at your peril. Teams that skip out on integration tests often experience nasty surprises in production, where components fail to work together despite passing unit tests.

### Top Layer: E2E Testing

[E2E tests](https://momentic.ai/blog/end-to-end-testing-tools-for-web-apps) simulate real user interactions across your entire app. They validate complete workflows from start to finish.

For example:

- User logging in and making a purchase
- Filling out and submitting a form
- Navigating through a multi-step process (e.g., form submission)

E2E tests are resource-intensive, take a long time to run, are difficult to debug, and are prone to flakiness; they need significant amounts of manual maintenance.

On the other hand, they are essential because they validate real user experiences and catch issues missed by lower-level tests. This is why they are at the top of the software testing pyramid; you can’t run lots of E2E tests and remain efficient.

## Balancing the Software Testing Pyramid

A common starting ratio is 70% unit tests, 20% integration tests and 10% E2E tests. No single ratio fits every project, so treat these numbers as a guide and adjust them to the risk profile of each product.

However, as a rough guideline, you could aim for:

- 70% Unit Tests
- 20% Integration Tests
- 10% E2E Tests

### How Do You Know When You’ve Got The Balance Wrong?

E2E tests verify actual user functions. They also fit nicely with the traditional [software testing lifecycle](https://momentic.ai/blog/the-software-testing-life-cycle), where you test a nearly-finished product after development has finished.

This makes it easy to attempt far too many of them. The testing pyramid becomes a testing ice cream cone, mostly E2E tests, with a few unit tests underneath.

**Common symptoms of test imbalance**

- Slow pipelines and flaky builds? Too many E2E tests.
- Annoying, system-level bugs slipping through? Too few integration tests
- Poor code quality and slow debugging? Not enough unit testing

## Best Practices for Implementing the Software Testing Pyramid

Four practices keep a test suite in the shape of a pyramid: shift testing left, run integration tests against realistic environments, limit E2E tests to the critical user journeys, and review the test distribution on a regular schedule.

### 1. Shift Left

Run your tests in parallel with development. This encourages more quick unit tests and [catches issues before they snowball](https://momentic.ai/blog/complete-guide-to-shift-left-software-testing) and become complex and expensive to fix.

### 2. Use Realistic Integration Environments

Where possible, test against real services or production-like setups to ensure that you get accurate data on how your code will behave in the real world.

### 3. Limit E2E Tests to High-Priority Actions

E2E tests are resource-intensive. Limit them to your most important user journeys (for example, logging in, submitting payment details, or completing key actions).

### 4. Continuously Evaluate Your Test Suite

Avoid bloat by regularly reviewing your test distribution and removing redundant or flaky tests.

## Testing Pyramid vs Testing Trophy vs Testing Diamond

The testing pyramid, the testing trophy and the testing diamond differ in which layer gets the most tests. The pyramid puts the bulk in unit tests, the trophy and the diamond put it in integration tests. All three keep E2E tests as the smallest layer.

| Model | Largest layer | Smallest layer | Best fit |
| --- | --- | --- | --- |
| Testing pyramid | Unit tests | E2E tests | Back-end services and libraries with clear unit boundaries |
| Testing trophy | Integration tests, plus a static analysis base | E2E tests | Front-end apps where units are thin and integration bugs dominate |
| Testing diamond | Integration tests | Unit and E2E tests | Microservices where contracts between services carry the risk |

Pick the model that matches where your bugs come from. If most of your production incidents come from components that fail together, move tests toward the middle layer.

### What Is an Inverted Testing Pyramid?

An inverted testing pyramid, also called the ice cream cone, is a test suite with many E2E or manual tests and few unit tests. It is the most common anti-pattern in QA, and it produces slow pipelines, flaky builds and a large maintenance bill. Fix it by adding unit and integration tests under the existing E2E tests, then retire the E2E tests that the lower layers now cover.

### Does the Testing Pyramid Apply to Mobile Apps?

Yes, the testing pyramid applies to mobile apps, and the ratio shifts toward the top. Mobile UI tests on simulators, emulators and real devices are slower than web E2E tests, so teams keep even fewer of them and lean on unit and integration tests around the UI layer. Tools such as XCUITest, Espresso, Appium, Maestro and Momentic cover the mobile E2E layer.

## Can the Software Testing Pyramid Keep Up With the Demands of Modern Testing?

Yes, the software testing pyramid keeps up with modern testing, but only if the top layer stops depending on manual effort. Release frequency goes up and systems grow more complex, so you need to test faster while the things you test get harder to test.

Not an easy ask.

Impossible, in fact, without shifting the tools and approach you use. There’s only so far that streamlining existing processes can get you; at some point, ‘doing more with less’ will become impossible

This is where AI comes in.

## Why AI Testing is Necessary for the Software Testing Pyramid

AI testing is necessary because the E2E layer is the one layer that traditional automation never made cheap. AI tools lower the cost to write and to maintain E2E tests, so a team can keep the pyramid balanced without a manual QA backlog.

Traditionally, automation has focused heavily on unit tests because scripts for them are easier to write and maintain. This leaves integration and E2E tests, arguably more valuable for real-world validation, at the whim of manual testing, and the speed/resource issues that come with it.

[AI tools like Momentic](https://momentic.ai/) are changing this dynamic by going beyond simple test automation. They introduce intelligence into how tests are created, maintained, and executed across the entire software testing pyramid.

Here’s what that looks like in real life:

### 1. Smarter Test Creation

[Autonomous ‘agentic’ AI](https://momentic.ai/blog/ai-agents-in-qa-testing) can work by itself to:

- Automatically generate test cases based on application behavior
- Identify edge cases that developers might miss
- Reduce the manual effort required to write tests

This is especially useful for E2E testing, where test scenarios are more complex. An engineer still reviews what the agent proposes, but the agent does the exploration and the first draft of the test.

### 2. Self-Healing Tests

One of the biggest challenges with E2E testing is brittleness. UI changes often break tests, leading to frequent maintenance.

AI-powered tools can [make automated AI tests considerably more reliable](https://momentic.ai/blog/test-automation-maintenance) by ‘self-healing’ broken tests automatically via smart, intent-based selectors. This reduces false negatives caused by minor changes in the UI.

### 3. Natural Language Test Creation

You describe each step of a test in plain English, and the AI locates the elements and performs the actions. The test lives as a file in your repository, so it goes through the same code review as the rest of your code.

### 4. Better Test Coverage Across Layers

Instead of over-relying on unit tests, AI tools help teams expand integration test coverage, automate complex workflows, and ensure critical paths are always tested. This leads to a more balanced and effective software testing pyramid.

### 5. Faster Feedback Loops

To ensure faster feedback, AI can prioritize and optimize test execution by:

- Running tests in parallel in CI, so a suite of hundreds of E2E tests finishes in minutes
- Returning a structured failure for each broken step: the step, a screenshot and a trace
- Grouping identical failures, so one root cause needs one fix

### 6. Tests That Stay Current With the Product

When the UI changes, an AI tool re-locates elements by their intent instead of by a brittle selector, so the test keeps working after a redesign. That maintenance work is what made E2E tests the most expensive layer of the pyramid.

## Momentic: More Efficient AI Software Testing

Momentic makes the E2E layer of the pyramid cheaper to build and to maintain: you write each test step in plain English, the runner performs it in a real browser or mobile device, and the test heals itself when the UI changes.

Momentic moves the testing pyramid beyond its traditional limitations to make more [extensive test coverage](https://momentic.ai/blog/test-coverage-vs-code-coverage) possible, especially for resource-heavy E2E testing scenarios.

After implementing Momentic, our customers Nuvo scaled to [80% frontend test coverage in 3 days](https://momentic.ai/customers/nuvo), with 90% faster test creation, end-to-end.

Want to join them? [Get a demo today](https://momentic.ai/sales)

## Software testing pyramid

What is the software testing pyramid?    The software testing pyramid is a model for distributing automated tests: many unit tests at the base, fewer integration tests in the middle, and a small number of end-to-end tests at the top. Lower layers run faster and cost less to maintain.    What is the ideal ratio of unit, integration and E2E tests?    A common starting point is 70% unit tests, 20% integration tests and 10% end-to-end tests. Adjust the ratio to where your bugs come from; no single ratio fits every project.    What is the difference between the testing pyramid and the testing trophy?    The testing pyramid puts most tests at the unit level. The testing trophy puts most tests at the integration level and adds static analysis as its base. Both keep end-to-end tests as the smallest layer.    What is an inverted testing pyramid?    An inverted testing pyramid, or ice cream cone, is a suite with many end-to-end or manual tests and few unit tests. It causes slow pipelines and flaky builds. Fix it by adding unit and integration tests under the E2E tests.    Does the testing pyramid apply to mobile apps?    Yes. Mobile UI tests on simulators and devices are slow, so the E2E layer stays small and unit and integration tests carry most of the coverage. XCUITest, Espresso, Appium, Maestro and Momentic cover the mobile E2E layer.    How does AI change the software testing pyramid?    AI lowers the cost of the end-to-end layer. Tools such as Momentic let you write test steps in plain English, run them in parallel in CI, and heal the tests when the UI changes, so a team can keep the pyramid balanced.

Still have additional questions?

## Keep reading.

[Resources   Best Puppeteer Alternatives for Browser Automation     Compare the best Puppeteer alternatives for browser automation, E2E testing, and web scraping. Explore Playwright, Selenium, Cypress, Momentic, and more.     Wei-Wei Wu     8 min read](/blog/puppeteer-alternatives)[Resources   Best Qodex Alternatives for UI Testing     Compare the best Qodex alternatives for UI testing, including Momentic, QA Wolf, mabl, Testim, and more. Explore AI-powered testing, self-healing locators, and web and mobile support.     Wei-Wei Wu     8 min read](/blog/qodex-alternatives)[Resources   Best Shiplight Alternatives for AI-Native Testing     Compare the best Shiplight alternatives for AI-native testing, including Momentic, Playwright, mabl, TestRigor, and QA Wolf. Explore self-healing, autonomous testing, mobile support, and more.     Wei-Wei Wu     7 min read](/blog/shiplight-alternatives)

## Close the feedback loop.

Point Momentic at your app. Free to start, no credit card.

[Try for free](https://app.momentic.ai/signup) [Contact sales](/sales)
