Skip to content

End-to-end test

An end-to-end test exercises the entire system from the user interface through every layer, database and external service, verifying that the complete flow works as a real user would experience it.

Definition

What it is

The layer is the top of the pyramid (see test-pyramid) and the most expensive per assertion. A single E2E flow can take 30-90 seconds to run in a containerised browser; a suite of 200 flows is 1-3 hours in CI. The economic trade-off is stark: E2E catches user-visible integration bugs that nothing else catches, but every E2E test you add costs more than the unit and integration tests combined.

The tooling is stable across the 2020s: Playwright (Microsoft, 2020) has become the dominant modern choice; Cypress (2015) remains strong for component-style E2E; Selenium (2004) is legacy but still in production at scale. Each has trade-offs, but the layer's semantics are the same: drive the real browser, assert on the real UI.

Why it matters

Two numbers frame the value. The Google Testing Blog's "Just Say No to More End-to-End Tests" (Wacker, 2015) — still the industry's most-cited piece on the subject — recommends 70% unit, 20% integration, 10% E2E and identifies E2E as the layer where flakiness compounds fastest [1]. Google's own analysis of 4.2 million test runs at the time found that the median E2E test failed intermittently at a rate of 1.5% per run — a rate that, on a suite of 500 tests, produces 7+ spurious failures per CI cycle.

The Chrome team's public engineering docs reinforce the point from the perspective of a project that invests heavily in E2E: Chromium runs ~50,000 E2E tests per commit across its CI fleet, at an infrastructure cost measured in thousands of CPU-hours per day [2]. The scale is achievable for a company with Google's resources; for the median SaaS, the honest budget is 10-50 E2E tests covering the flows whose failure would cost revenue in real time — sign-up, checkout, login, payment, critical API.

How it works

graph TD
  T[E2E test runner<br/>Playwright, Cypress, Selenium] --> B[Real browser<br/>headless or headful]
  B --> F[Real frontend]
  F --> A[Real backend API]
  A --> D[(Real database)]
  A --> X[Real external services<br/>payment, email, SMS]
  D --> S[Assert on final state]
  X --> S
  style B fill:#E8F5E9
  style D fill:#E8F5E9
  style S fill:#E8F5E9

Three principles define a healthy E2E suite. Few and critical: cover the flows whose failure costs revenue, not every screen. Realistic: run against a staging environment that mirrors production (same database schema, same external service sandboxes). Deterministic: seed the data, freeze the clock, isolate per test — flakiness in E2E is almost always the test environment, not the code.

The trade-off, quantified

Metric

Unit

Integration

E2E

Runtime per test

5-50 ms

200-800 ms

5-60 seconds

Flakiness rate

<0.1%

0.5-2%

1-5%

Infrastructure cost per run

Negligible

Low

High

Debug time when failing

Seconds

Minutes

15-60 minutes

Business-critical coverage

None

Partial

Full

The flakiness numbers are the ones that kill teams. A suite with 5% E2E flakiness on 100 tests produces 5 false failures per run — the team spends an hour a day chasing ghosts, then stops trusting the suite, then stops fixing real failures. Google's own engineering book confirms the pattern: the team that owns the flaky test system at Google uses the same statistical machinery as spam detection to identify flaky tests because the signal-to-noise ratio is so bad [3].

Common failures

Origin

Before the web, "end-to-end" tests were manual QA. Selenium (2004) made browser automation feasible; by 2010 it was the default for any web project. The 2010s brought a counter-movement: teams had over-invested in E2E (the "ice cream cone" anti-pattern, see test-pyramid) and CI was collapsing under flakiness and duration. Wacker's 2015 post and Cohn's pyramid (2009) rebalanced the industry. Cypress (2015) and Playwright (2020) brought better DX to a layer that everyone agreed was necessary but under-invested in quality.

  1. 2004 — Selenium launches; browser automation becomes feasible

  2. 2009 — Cohn's test pyramid formalises the layer as top-of-pyramid

  3. 2015 — Wacker's "Just Say No" rebalances the industry

  4. 2015 — Cypress launches, modern DX for component-style E2E

  5. 2020 — Playwright (Microsoft) enters the market

  6. 2024 — Playwright becomes the dominant modern choice

E2E tests are expensive to write, slow to run, and often flaky. But they are the only tests that prove a user can complete a critical flow. Do them; do them few; do them well.

— adapted from Mike Cohn, *Succeeding with Agile*, 2009
10% · E2E en el split recomendado 70/20/10 (Google 2015)
1,5% · tasa de flakiness por test E2E en Google (Google 2015)
~50.000 · E2E tests por commit en Chromium CI (Chromium 2024)
20-50× · coste de un E2E vs un unit (medido en CPU-horas)

Evidence

FAQ

How many E2E tests?

10-50 for the median SaaS. Cover the flows whose failure costs revenue: sign-up, login, checkout, payment, API authentication, critical integrations. Everything else is integration or unit.

Playwright, Cypress or Selenium?

Playwright (2020) is the modern default — better cross-browser, better async, faster. Cypress remains strong for component-style E2E. Selenium only for legacy suites.

How do I reduce flakiness?

Four levers: (1) isolate data per test (unique emails, unique orders), (2) freeze time and random, (3) run against a per-test environment (container, ephemeral DB), (4) retry only known-flaky tests and track them explicitly.

Should E2E run on every commit?

On the critical subset (10-20 tests), yes. The full E2E suite runs nightly or pre-release. Every-commit full E2E is a CI bottleneck that costs more than it saves.

Connections

Etymology

Origin: compound

  • end-to-end (adjective): English construction, "from one end to the other"
  • test (noun): from Latin testum, "earthen pot"

Semantic network

End-to-end tsoftware-tTest pyramUnit testIntegratioTest pyramContract tflaky-test

● broader ● narrower ● related

Sources