how to sunset obsolete tests safely
Sunsets obsolete tests safely: deprecation, verification, and removal. Use when tests cover removed features. Not for flaky tests (quarantine those).
TL;DR
Remove tests for dead features deliberately: confirm the feature is gone, check the tests are not covering something else, delete, and verify the suite is still meaningful.
Error
(Not an error; a cleanup workflow. The risk it avoids: deleting tests that still protect live behavior.)Steps
- Confirm the feature is removed from the product, not just hidden. Expected: product confirmation.
- Check the tests do not also cover shared behavior (helpers, utilities). Expected: the blast radius known.
- Delete the tests and their exclusive fixtures. Expected: clean removal.
- Run the suite and check coverage of the surrounding area. Expected: no unintended gaps.
- Note the removal in the PR. Expected: reviewers see the deliberate cleanup.
When to use
- Features removed from the product.
- Tests for deprecated APIs past their sunset date.
When not to use
- Flaky tests (quarantine, do not delete).
- Tests you suspect are wrong (investigate first).
Tool compatibility
- Any framework.
Variant phrasings
Delete obsolete tests
The task; verification first.
Test cleanup after feature removal
The trigger; the workflow is the same.
Why it happens
Dead tests slow the suite and confuse readers. But hasty deletion removes protection, so verify before deleting.
Edge cases
- Feature flags can resurrect "removed" features; check flag state.
- Shared fixtures may serve live tests; delete selectively.
- Keep a tombstone note if the deletion might confuse future archaeologists.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_s6zNZzPCzZdAyTr714bd1g
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.