3. The test pyramid in practice
Test Automation · 48 pages source format
The pyramid is a budget. Most checks should be fast and close to logic. A few UI journeys prove the seams. This chapter turns the diagram into daily decisions and written policy.
What you'll learn
- Unit, integration, API, UI tradeoffs
- How to spot duplicate coverage
- Smoke vs deep suites
Draw your real pyramid
Ideal pyramids are rare. Start with what you have, then rebalance. Count tests by layer and by runtime.
Do this now
Sketch three layers. Estimate count and minutes for each. Circle the top-heavy parts.
Kill vanity coverage
A 200-test UI suite that duplicates API checks wastes CI. Prefer one clear owner per risk.
Do this now
Find two tests that assert the same thing. Delete or demote one on paper.
Pro tip. Coverage % without risk context is a vanity metric.
Smoke pack definition
A 5–10 minute smoke suite should prove “the product boots and money paths work.” Deep suites run less often or in parallel shards.
Do this now
Name 5 smoke scenarios for an e-commerce site. Estimate runtime per scenario.
Shift-left in plain language
Shift-left means finding bugs where they are cheapest to fix — in unit/API layers before UI. It is not “skip manual testing.”
Do this now
For checkout flow, list what devs can unit-test, what QA automates at API, what needs one UI journey.