When to Skip or Delete Tests
You'll learn: how to identify tests that waste time and effort, and when removing them actually makes your codebase healthier.
The Counterintuitive Truth
Not all tests add value. Some tests slow you down without making your code safer. Just like clutter in your home, test clutter makes it harder to find what matters and maintain what's useful.
Recognizing Low-Value Tests
Tests that duplicate coverage are the most common offenders. If three different tests all verify the exact same behavior through slightly different setups, you're paying triple the maintenance cost for single coverage. When you change that behavior, all three tests break.
Tests that test the framework or language add no value. If you're testing that a library you imported works as documented, you're wasting effort—the library already has its own tests.
Redundant integration tests often re-verify what unit tests already cover. If your unit tests prove module A and module B work correctly, and your integration test just calls both in sequence without testing their interaction, it's redundant.
When Deletion Improves Velocity
Deleting tests makes sense when:
- The test breaks frequently but catches no real bugs (brittle tests)
- Multiple tests cover identical scenarios
- The code being tested no longer exists or is unreachable
- The test's maintenance cost exceeds the risk of the code breaking
Think of it like insurance: you don't insure things that are cheap to replace or unlikely to fail catastrophically.
The Risk Assessment
Before deleting, ask: "If I remove this test and this code breaks, what's the actual impact?" Low-impact code with expensive tests is a prime deletion candidate.
Key Takeaway: Tests have maintenance costs—removing redundant, low-value, or brittle tests reduces friction and lets you focus testing effort where risk and impact are highest.