Test Pyramid vs Testing Trophy: Which Model Should You Follow?
Two mental models dominate how developers think about test strategy: the Test Pyramid (Mike Cohn, 2009) and the Testing Trophy (Kent C. Dodds, 2018). They look similar but make different recommendations. Following the wrong one for your context leads to either slow, brittle tests or tests that give false confidence.
This comparison breaks down what each model says, where they agree, where they conflict, and which fits your situation.
The Test Pyramid
Mike Cohn introduced the Test Pyramid in Succeeding with Agile:
┌──────┐
│ UI │ ← few
┌┴──────┴┐
│Service │ ← some
┌┴────────┴┐
│ Unit │ ← many
└──────────┘The pyramid's message: most tests should be unit tests. They're fast, cheap, and reliable. UI (end-to-end) tests are expensive and slow—keep them few. Service (integration) tests sit in the middle.
The underlying principle: speed and isolation increase as you go down. Unit tests are milliseconds. UI tests are seconds or minutes.
The Testing Trophy
Kent C. Dodds proposed the Testing Trophy in 2018:
┌──────────┐
│ E2E │ ← few
┌─┴──────────┴─┐
│ Integration │ ← most tests here
┌─┴──────────────┴─┐
│ Unit │ ← some
┌─┴──────────────────┴─┐
│ Static Analysis │ ← foundation
└───────────────────────┘The Trophy's message: most tests should be integration tests. They provide the best confidence-to-cost ratio. Static analysis at the base catches whole error categories for free. Unit tests cover complex logic. E2E tests cover critical paths.
The underlying principle: confidence proportional to how closely tests resemble real usage.
Where They Agree
Both models agree on:
- Fewer UI/E2E tests. Expensive to write, slow to run, brittle to maintain. Both say: use them strategically, not as your primary coverage strategy.
- Layer your tests. Neither says "only write one type of test." Both recommend a combination.
- Automation is essential. Manual testing doesn't appear in either model's main layers.
- Fast feedback matters. Both value tests that give developers quick signals.
Where They Differ
Unit test investment
| Model | Stance on unit tests |
|---|---|
| Pyramid | Primary investment—most tests should be unit tests |
| Trophy | Secondary to integration—unit tests for logic, not orchestration |
The Pyramid assumes unit tests with mocks are efficient and reliable. The Trophy argues that mocked unit tests create a confidence gap—tests pass against fakes that don't match reality.
Integration test investment
| Model | Stance on integration tests |
|---|---|
| Pyramid | "Service layer"—important but secondary to units |
| Trophy | Most valuable layer—widest, highest ROI |
Static analysis
| Model | Static analysis |
|---|---|
| Pyramid | Not mentioned (predates TypeScript's widespread adoption) |
| Trophy | Foundational layer—catch errors before tests run |
The Mocking Problem
This is the crux of the disagreement.
The Pyramid assumes mocking is fine. If you mock your database, you can write fast, isolated unit tests. The database is the database's problem to test.
The Trophy argues mocking creates false confidence. When your OrderService unit test mocks the PaymentService, and PaymentService changes its API, your unit test still passes. Your mocked unit test asserted against a fake that no longer reflects reality.
// Pyramid approach: mock everything
const mockPayment = { charge: jest.fn().mockResolvedValue({ success: true }) };
const orderService = new OrderService(mockPayment);
await orderService.place(order);
expect(mockPayment.charge).toHaveBeenCalled(); // ✓ passes even if PaymentService changed
// Trophy approach: use real integration
const orderService = new OrderService(realPaymentClient); // or in-memory fake
await orderService.place(order);
// Tests real behaviorThe Trophy trades test speed for test realism.
Which Context Fits Each Model
The Pyramid fits when:
You have a large, stable domain layer. If most of your logic is in pure business functions—calculations, transformations, validations—unit tests are efficient and reliable.
// Banking system: complex pure logic everywhere
// Unit tests are the right tool
@Test
void calculatesAmortizationSchedule() { ... }
@Test
void appliesEarlyPaymentPenalty() { ... }Integration tests are genuinely expensive. If your integration tests require real databases, real message queues, and real external services that are slow to spin up, the cost-benefit tilts toward unit tests.
Your team is large and parallel. Isolated unit tests run fast in CI, parallel, without interference. Integration tests may share state and require coordination.
Backend-heavy services. Pure service logic, algorithms, domain models—unit tests with mocks are reliable when the logic is complex and the integrations are simple.
The Trophy fits when:
You build UI-heavy applications. React, Vue, Angular components involve complex interactions between state, rendering, and events. Testing them in isolation with mocked props tests a fiction. Integration-style testing with React Testing Library tests real behavior.
Integration points are where bugs actually hide. If your production bugs are consistently at integration seams—between the form and the API, between the service and the database—unit tests aren't finding them.
Your tech stack makes integration tests affordable. In-memory databases, fast test frameworks, Docker-based test environments—when integration tests run in seconds, the cost argument against them weakens.
You're building developer tooling or frameworks. Library authors (like Kent, who works on React Testing Library) care deeply about how code is actually used, not how it behaves in isolation.
The False Dichotomy
Most experienced teams don't choose one model exclusively. They apply both sensibly:
Scenario Approach
─────────────────────────────────────────────────────────────
Complex domain logic Pyramid: heavy unit tests
React components Trophy: integration tests with RTL
API route handlers Trophy: integration tests
Database queries Pyramid (unit) + integration (real DB)
Critical user flows Both: E2E tests
Math/calculations Pyramid: unit tests with edge cases
Form submission workflows Trophy: integration testsA Practical Synthesis
Neither model is complete on its own. A practical synthesis:
- Static analysis: TypeScript, ESLint. Free. Non-negotiable.
- Unit tests for logic: Complex algorithms, pure functions, edge cases. Pyramid's strength.
- Integration tests for behavior: How components/services work together. Trophy's strength.
- E2E tests for critical paths: The flows that cannot fail. Both models agree on "few."
- Exploratory testing: Human judgment that no model captures. Required regardless.
Metrics to Track
Rather than following a model dogmatically, track what matters:
- Bug escape rate: Are bugs reaching production? If yes, which layer would have caught them?
- Test run time: How long does CI take? If too long, optimize the expensive layers.
- False positives: How often do tests fail for reasons unrelated to bugs? Mocking overuse causes this.
- Test maintenance cost: How much time is spent updating tests on refactors?
Let these metrics guide whether you lean Pyramid or Trophy.
HelpMeTest at the Top
Both models converge at the E2E layer: critical paths, real users, real browsers. That's where HelpMeTest operates.
Whether you follow the Pyramid or the Trophy for your unit and integration layers, HelpMeTest covers the top: plain-English tests that run against your live application in a real browser, 24/7. Write the test scenario in English; HelpMeTest handles the automation.
Summary
| Test Pyramid | Testing Trophy | |
|---|---|---|
| Focus | Unit tests | Integration tests |
| Base | Unit tests (fast, isolated) | Static analysis (free) |
| Middle | Service/integration tests | Integration tests (widest) |
| Top | UI/E2E tests (few) | E2E tests (few) |
| Mocking | Favored | Skeptical |
| Best for | Backend logic, large teams | UI-heavy apps, realistic testing |
| Weakness | Confidence gap from mocks | Slower test suite |
Pick the model that matches your context. Apply both where appropriate. Track bug escape rates to tell which layer is actually failing you.