Different test levels answer different questions. A large end-to-end suite is not automatically safer, and a passing unit test cannot prove that the deployed application is wired correctly.
Match the test to the risk
- Use a unit test for a deterministic function or rule with small inputs and outputs.
- Use an integration test when behavior depends on a boundary such as a database adapter, API client, or component interaction.
- Use a small end-to-end test for the critical path that must work across routing, rendering, and real application wiring.
Keep feedback useful
Prefer many fast checks and fewer slower browser journeys. Give each test a clear failure message and avoid asserting implementation details that can change without affecting the user's outcome.
When a defect reaches production, add a regression check at the lowest level that would have caught the actual cause, then retain an end-to-end check if the integration path itself is important.
