Unit Tests vs. Integration Tests
Testing Pyramid vs. Testing Trophy
Unit tests are fast and cheap. Integration tests catch real bugs. The question is where to invest your testing budget.
📊 Scoring Matrix
Milliseconds per test
Seconds to minutes per test
Component-level correctness
System-level correctness
Breaks on refactoring
Resilient to refactoring
Narrow (single function)
Broad (feature workflow)
Cheap to write and run
Expensive (infra, data, time)
Logic errors in isolation
Integration and contract bugs
📋 Executive Summary
The testing trophy (more integration, fewer unit) is winning over the testing pyramid. Test behavior, not implementation.
Over-investing in unit tests costs 2-3x in maintenance. Under-investing in integration tests lets shipped bugs through.
🎯 Decision Framework
- ✓ Complex business logic validation
- ✓ Algorithm correctness
- ✓ Fast CI/CD feedback loops
- ✓ Mathematical/financial calculations
- ✓ API contract validation
- ✓ User workflow testing
- ✓ Database interaction testing
- ✓ Cross-service communication
Complex business logic? Unit test it. API endpoints and workflows? Integration test those. Delete tests that break on every refactor.
🌐 Market Context
Kent C. Dodds' "Testing Trophy" challenging the traditional Testing Pyramid. Playwright and Cypress making integration tests easier.
Integration test investment growing 2x. Unit test coverage as a metric declining in favor of behavior coverage.
🛠️ Related Tools
Keep exploring
Need Help Deciding?
Book a 60-minute advisory session. I'll map these frameworks to your specific context, team size, and budget.