Testing Strategy Shape
The distribution of tests across levels, chosen so that feedback is fast where it can be and confidence is real where it must be.
The classic pyramid — many unit tests, fewer integration tests, very few end-to-end tests — is a heuristic about cost and speed, not a rule about counts. Its logic holds: tests at lower levels are faster, more reliable and localise failures better; tests at higher levels prove more and cost more.
The two failure shapes have names. The ice cream cone — mostly end-to-end tests — produces a suite that is slow, flaky, and expensive to maintain, and it is what happens when unit testing is skipped early. The hourglass — many unit and end-to-end tests with nothing in between — misses integration failures, which is where a large share of real defects live.
Where the shape should shift: a service that is mostly integration — thin logic over a database and three APIs — legitimately has more integration tests than units, because the units are trivial and the risk is in the wiring. Testcontainers-style real dependencies have made this much cheaper than when the pyramid was formulated.
The complements that reduce the need for end-to-end tests: contract tests verify interfaces between services in seconds without a shared environment; and progressive delivery with production monitoring catches what testing cannot — which is why mature organisations invest in fast rollback rather than in more end-to-end coverage.