14 / 62 · 22 Test Strategy & Quality Metrics · Test Pyramid in Practice← prev⊞ allnext →☰ Read as one page
2.6Mapping Your Current Test Suite to the Pyramid
Step 1: Inventory Your Tests
Categorize every test in your suite:
Test Inventory -- ShopFlow Project
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Unit tests: 412 (68%) │████████████████████ │
Integration tests: 89 (15%) │████ │
E2E tests: 104 (17%) │█████ │
─────
Total: 605
Execution time:
Unit: 42 seconds
Integration: 3 minutes 18 seconds
E2E: 28 minutes 45 seconds
Total: 32 minutes 45 seconds
E2E tests are 17% of the count but 88% of the execution time.
Step 2: Identify the Shape
Based on the inventory above, this team has a reasonable pyramid shape with a slightly heavy E2E layer. The key question is: are those 104 E2E tests all necessary, or are some testing things that could be covered at a lower level?
Step 3: Analyze the Gaps
| Area | Unit Coverage | Integration Coverage | E2E Coverage | Gap |
|---|---|---|---|---|
| Payment logic | 95% | 80% | 100% | None -- well covered |
| User auth | 70% | 40% | 100% | Integration gap: auth + session |
| Search | 90% | 20% | 60% | Integration gap: search + database |
| Admin tools | 30% | 10% | 80% | Heavy E2E reliance, few unit tests |
Step 4: Make Recommendations
Based on this analysis:
- Admin tools: Push test coverage down. Write unit tests for admin business logic. This is currently an ice cream cone for this feature area.
- User auth: Add integration tests for the auth-session boundary. The E2E tests cover it but cannot pinpoint failures.
- Search: Add integration tests for the search-database interaction. The 20% integration coverage is dangerously low for a high-traffic feature.