When to Delete a Test

Not every test deserves to live forever. Some tests stop pulling their weight and become liabilities. Knowing when to delete a test is a skill.

Signs a Test Should Be Deleted

1. It's Redundant

Multiple tests assert the same thing with slightly different wording. If deleting one doesn't reduce confidence, it's dead weight.

2. It's Brittle

The test breaks constantly due to harmless refactors (renames, formatting changes) without actually catching real bugs.

3. It's Meaningless

Tests that assert trivial facts (e.g., assertTrue(true)) or just hit code for coverage don't provide value.

4. It's Obsolete

The functionality under test has been removed, or the test is checking a deprecated path no one relies on.

5. It's Too Expensive

A test that takes 20 minutes to run and rarely finds a bug might be better off archived or reimagined.

What To Do Before Deleting

  • Ask: Does this test give us unique confidence no other test provides?
  • Check History: Has it caught meaningful bugs in the past?
  • Refactor First: Sometimes brittle tests can be rewritten into better ones instead of nuked.

Healthy Deletion Mindset

  • Deleting a test isn't failure — it's maintenance. Just like code, your test suite has a lifecycle.
  • Every test carries a cost (time to run, maintain, and understand). If it no longer pays for itself, let it go.

Golden Rule

👉 If a test doesn't increase confidence, it's technical debt. Delete it.