Should You Quarantine, Fix, or Delete a Flaky Test?
Quarantine a flaky test when it is blocking the pipeline but you cannot fix it immediately; fix it when the test covers behaviour that genuinely matters and the root cause is addressable; and delete it when it is redundant, low-value, or has rotted beyond economic repair. The mistake most teams make is treating quarantine as a permanent destination rather than a temporary holding pen, which is how suites accumulate hundreds of ignored tests that protect nothing.
## Start by asking what the test protects
Before deciding anything, establish the test's value:
- **What behaviour does it verify?** A flaky test guarding a critical revenue path deserves a fix; one re-checking a trivial UI label may not.
- **Is it unique?** If three other tests already cover the same flow, this one may be redundant.
- **When did it last catch a real bug?** A test that has only ever produced flaky failures and never caught a genuine regression is a liability, not an asset.
This triage question matters more than the flakiness itself, because it determines whether the test is worth any further investment at all.
## When to quarantine
Quarantine is the right immediate move when a flaky test is breaking builds and you cannot fix it on the spot.
- Move it to a non-blocking lane that still runs and reports.
- Tag it with the suspected cause and a ticket.
- **Set an explicit expiry date.** This is the rule that prevents quarantine becoming a graveyard.
Quarantine buys you a stable pipeline today without abandoning the coverage permanently. But it is a loan against future effort, not a resolution.
## When to fix
Fix the test when both of these are true: the behaviour it covers is valuable, and the root cause is something you can realistically resolve.
- Most flaky tests fail for well-understood reasons: timing races, shared state, non-deterministic data, or unstable locators. These are fixable.
- A test covering a critical user journey almost always justifies the fix, even if the fix takes real effort.
- After fixing, verify with many repeated runs before returning it to the blocking suite. One green run proves nothing.
## When to delete
Deletion is the correct, underused decision in several cases:
- **Redundant coverage.** Another reliable test already verifies the same behaviour.
- **Low value.** The test guards something trivial that would not matter if it broke.
- **Unfixable rot.** The test is so entangled with implementation detail that repairing it would cost more than rewriting the coverage from scratch.
- **Chronic recurrence.** It has been "fixed" repeatedly and keeps returning to flakiness, signalling a structural problem with the test design.
Deleting a bad test is not a failure. A test that cries wolf reduces overall quality by training engineers to ignore red builds. Removing it can raise the trustworthiness of the whole suite.
## A simple decision flow
1. Is the behaviour covered elsewhere reliably? If yes, **delete**.
2. Is the behaviour low-value or trivial? If yes, **delete**.
3. Is the behaviour valuable and the cause addressable? If yes, **fix** (quarantine first if it is blocking right now).
4. Is it valuable but you cannot fix it today? **Quarantine with an expiry**, then fix before the date.
5. Has it been fixed repeatedly and keeps failing? Consider **delete and rewrite**.
## Govern the quarantine
Quarantine only works with governance:
- **Cap its size.** A growing quarantine is a backlog in disguise.
- **Review it on a schedule.** Weekly or fortnightly, walk the list and force a decision: fix now, extend with justification, or delete.
- **Assign ownership.** Tests without an owner drift indefinitely.
- **Track age.** Anything past its expiry gets escalated.
Without these controls, quarantine quietly defeats its own purpose. neart.ai builds enterprise-grade quality products that help teams track quarantine health and flake recurrence, which are precisely the signals that tell you whether a test deserves a fix or the bin.
## Takeaway
The quarantine-fix-delete decision turns on value and cause, not on flakiness alone. Quarantine to unblock today, fix what is valuable and addressable, and delete what is redundant, trivial, or rotten. Above all, govern your quarantine with expiries, ownership, and regular review, so it stays a temporary holding pen and never becomes a graveyard of tests that protect nothing.