Unit tests verify small pieces in isolation, integration tests verify collaboration between components, and end-to-end tests validate full user flows across the system.
Each level trades speed for realism:
A healthy suite balances all three with a clear goal per layer.
Checkout flow:
Unit: price calculation
Integration: service + DB
E2E: user adds to cart -> pays -> receipt