16 / 62 · 22 Test Strategy & Quality Metrics · Test Pyramid in Practice← prev⊞ allnext →☰ Read as one page
2.8Practical Exercise: Audit Your Project's Test Distribution
Exercise Steps
- Count your tests by type. Use your test runner's output or directory structure.
# Example for a JavaScript project
echo "Unit: $(find src -name '*.test.ts' | wc -l)"
echo "Integration: $(find tests/integration -name '*.test.ts' | wc -l)"
echo "E2E: $(find tests/e2e -name '*.spec.ts' | wc -l)"
Measure execution time by type. Run each test suite separately and record the time.
Calculate the percentages. What percentage of your tests are at each level? What percentage of your execution time is at each level?
Identify the shape. Is it a pyramid? Trophy? Diamond? Ice cream cone? Hourglass?
Compare to the ideal. Based on your product type (SaaS, mobile, API, etc.), which model fits best?
List the gaps. Which features have the wrong test distribution? Where are you over-investing in expensive test types?
Propose 3 changes. Based on your analysis, identify 3 specific actions to improve the test distribution (e.g., "Convert 10 E2E tests for admin tools to unit tests, add 5 integration tests for search-database interaction").