Modern QA2026Cost Analysis: Cost Per Test Type — tiles
Log inJoin
15 / 62 · 22 Test Strategy & Quality Metrics · Test Pyramid in Practice← prev⊞ allnext →☰ Read as one page

2.7Cost Analysis: Cost Per Test Type

Cost Model

Cost Factor Unit Test Integration Test E2E Test
Write time 10-30 min 30-60 min 1-4 hours
Execution time < 1 second 1-10 seconds 30 seconds - 5 minutes
Maintenance per year Low (rarely breaks) Medium (breaks on API changes) High (breaks on UI changes)
Infrastructure cost None (runs anywhere) Low (needs test DB or mocks) High (needs browser, servers, data)
Flakiness risk Very low Low High
Debugging time on failure 5 minutes (pinpointed) 15 minutes (narrowed to boundary) 30-60 minutes (could be anywhere)

ROI Comparison

Assume a bug in the checkout flow that could be caught at any level:

Unit test:
  Write: 20 min, Run: 0.5s, Maintain: 5 min/month, Debug on fail: 5 min
  Annual cost: ~2 hours

Integration test:
  Write: 45 min, Run: 5s, Maintain: 15 min/month, Debug on fail: 15 min
  Annual cost: ~4 hours

E2E test:
  Write: 2 hours, Run: 2 min, Maintain: 45 min/month, Debug on fail: 45 min
  Annual cost: ~12 hours

The E2E test costs 6x more annually than the unit test. If the bug can be caught at the unit level, the E2E test is a waste of resources. But if the bug is specifically about how the checkout page interacts with the payment API, only the integration or E2E test will catch it. The key is matching the test level to the type of risk.