Blog
The Test Pyramid Is A Cost Model, Not A Quota
“Seventy percent unit tests” is not a quality strategy. Percent of what: methods, behaviors, lines, or effort?
The test pyramid is useful because fast isolated checks are cheap and full-system checks are expensive. It does not assign universal quotas.
Match Boundary To Failure
A fee calculation needs a pure domain test. A SQL query needs a real database. A JSON compatibility promise needs a serialization or API test. One end-to-end flow proves the wiring.
Testing SQL through a mocked repository is cheap and irrelevant. Starting the whole application to test addition is realistic and wasteful.
Keep A Small Expensive Layer
End-to-end tests are slower, harder to diagnose, and sensitive to environment. Keep enough to cover critical journeys and deployment wiring. Do not ask them to enumerate every business boundary.
Track suite duration and failure diagnosis time. A test that fails randomly creates negative confidence even if it lives in correct geometric layer.
Duplication across layers is not automatically waste. A domain rule may have exhaustive unit coverage and one broader test proving the real adapter invokes it correctly. The mistake is repeating the same edge-case matrix through every boundary. Let each layer answer a different failure question.
Start from risks, choose cheapest boundary that can observe each one, then keep a few broad checks for integration gaps. That is pyramid thinking without spreadsheet religion.