A test layer is a containment zone: it defines how far a defect can travel before detection. Match the layer to the risk and the cost of finding a failure late, rather than aiming for coverage alone. section 5.3 section 5.9
Match the containment zone to the failure being protected against:
- Unit tests check business rules, calculations, transformations, and invariants in milliseconds. section 5.3
- Integration tests check collaboration across boundaries—such as persistence, API contracts, and authentication—in seconds. section 5.3
- End-to-end tests protect critical user journeys in minutes; production may reveal failures hours or days later. section 5.3
Choosing a layer by risk
For a login-to-calculation journey, test authentication and database behavior at the integration layer, calculation rules with unit tests, and only the critical customer-visible flow end to end. section 5.3
Figure 5.2 Comparing the standard testing pyramid with a Lean interpretation of the same structure. The Lean view keeps the same shape but changes the intent.

The pyramid keeps its familiar shape but shifts the emphasis from test distribution to each layer’s containment role. section 5.3
