Testing Glossary

Test Retry

The practice of automatically re-running a failed test one or more times to determine whether the failure is persistent or intermittent.

A test retry is an automatic mechanism that re-executes a test after it fails. If the test passes on a subsequent attempt, the failure is typically classified as intermittent rather than genuine. Most modern test frameworks and CI systems support configurable retry behavior, allowing teams to specify the maximum number of attempts and whether retried-and-passed tests should be flagged in reports.

Why Retries Exist

Retries are a pragmatic response to flaky tests. In an ideal world, every test would be perfectly deterministic, and retries would be unnecessary. In practice, tests interact with networks, databases, browsers, and other infrastructure that can introduce transient failures. Retries prevent these intermittent issues from blocking the entire CI pipeline while the underlying flakiness is addressed.

Retries as a Diagnostic Tool

The real value of retries lies not in masking failures but in surfacing them. When a test monitoring tool tracks which tests required retries to pass, it creates a clear list of flaky tests that need attention. This data is far more actionable than a binary pass/fail result. Teams can prioritize fixing the most frequently retried tests, track flakiness trends over time, and measure whether their remediation efforts are working.

Risks of Over-Relying on Retries

Retries have a cost. Each retry adds to the total pipeline duration. A test that is retried three times consumes four times the compute resources. More critically, excessive retries can mask real failures. If a genuinely broken test occasionally passes on retry due to a race condition, the bug slips through. Teams should set retry limits conservatively — typically one or two retries — and treat any test that frequently needs retries as a priority fix.

Best Practices

Configure your test framework to report retried tests distinctly from clean passes. Feed retry data into your test monitoring platform so that flaky tests are automatically detected and tracked. Set alerts when the number of retried tests exceeds a threshold. Most importantly, treat retries as a short-term safety net, not a long-term solution — the goal is always to fix the underlying flakiness.

Related Terms

Monitor Your Test Suite Health

TestGlance tracks test results, detects flaky tests, and surfaces health trends automatically.

Get Started