Course contentsShow
← Software Engineering
Lesson 577 of 1,93317. End-to-End and UI TestingFree lesson

Quarantining and Flaky Test Management

Implement strategies for identifying, quarantining, and systematically fixing flaky tests rather than ignoring them.

Quarantining and Flaky Test Management

What you'll learn: How to systematically identify, isolate, and fix flaky tests instead of letting them erode confidence in your test suite.

The Problem with Ignoring Flaky Tests

A flaky test passes sometimes and fails other times without any code changes—like a light bulb that flickers unpredictably. When your team starts ignoring test failures because "it's probably just that flaky test again," you've lost the entire value of automated testing. Real bugs can hide behind flaky failures.

The Quarantine Strategy

Instead of deleting flaky tests or letting them pollute your CI pipeline, quarantine them:

  1. Identify flaky tests by tracking failure patterns (does it fail 10% of the time?)
  2. Mark them explicitly with tags like @Flaky or move them to a separate test suite
  3. Prevent blocking by excluding quarantined tests from your main CI pipeline
  4. Track systematically using a dedicated list or dashboard
  5. Fix deliberately by assigning ownership and setting deadlines

Think of It Like Triage

Quarantining is like a hospital's isolation ward. You don't send sick patients home (delete tests) or mix them with healthy patients (ignore failures). You isolate them, treat them, and reintegrate them once they're stable.

The Fix-It Process

When addressing a quarantined test:

  • Run it hundreds of times locally to reproduce the flakiness
  • Apply the stability techniques you've learned (explicit waits, retry logic, stable selectors, isolated test data)
  • Once it passes 500+ consecutive runs, restore it to the main suite
  • Monitor it closely for relapses

Key Takeaway: Quarantining flaky tests preserves the integrity of your CI pipeline while creating accountability to fix them systematically—turning an ignored problem into a managed backlog with clear ownership and resolution paths.