August 14, 2026


Test retries in automated suites help teams tolerate genuine external non-determinism — network jitter, transient infrastructure failures, timing variability in third-party integrations — but they suppress defect signal when applied to failures caused by application bugs, brittle selectors, or inadequate wait conditions. A test that fails due to a genuine application defect, retries once, and passes on the second attempt does not produce a passing result; it produces a false pass that allows the defect to advance through the pipeline. In 2026, as retry support has become default configuration in Playwright, Jest, Cypress, and most CI platforms, the tendency to enable retries freely has made quality signals harder to trust in suites where the retry policy was not designed with failure cause categories in mind.
For engineering teams managing automated test suites, the critical question is not whether to use retries but which failures warrant retry and which warrant immediate investigation. This guide covers what retries are designed for, when they hide real problems, how to audit whether your retry configuration is producing false passes, and how to set retry policies that tolerate genuine external non-determinism without accumulating masked defects. Teams looking to structure their overall test automation investment can consult the manual vs. automated testing guide for context on how retry policies fit into a broader automation strategy. For hands-on assistance evaluating test suite quality and retry configuration, Astaqc’s test automation services team provides targeted audits of existing suites.
Retries in automated test suites were introduced to address a real problem: automated tests sometimes fail for reasons that have nothing to do with the application under test. A CI runner with a temporarily elevated load average may cause a wait condition to time out. A network request to a third-party service may return a 503 that resolves seconds later. A shared test database may be briefly unavailable during a maintenance window. In each case, retrying the test produces an accurate pass because the failure cause was genuinely transient and the application behavior is correct.
These scenarios share a defining characteristic: the failure is caused by infrastructure or external dependencies, not by the application or the test itself. The retry produces a passing result that accurately reflects the application’s actual behavior under normal conditions. Retry policies designed for this use case are typically narrow: one or two retries maximum, with a short delay between attempts, applied to tests that interact with known non-deterministic external infrastructure.
When retry policy is calibrated correctly for this use case, the pass rate of retried tests is high — most retried tests pass on the first retry because the transient condition has resolved — and the rate of tests requiring a second retry is low. A suite where a significant proportion of retried tests regularly require the maximum retry count to pass is not tolerating transient infrastructure conditions; it is suppressing unstable tests that have not received root cause analysis.
| Failure Type | Does Retry Help? | Correct Response |
|---|---|---|
| Transient network failure to a third-party service | Yes — condition resolves on its own | Retry with short delay; 1–2 attempts maximum |
| CI runner performance degradation causing timeout | Sometimes, depends on runner availability | Retry; also investigate runner provisioning if frequent |
| Missing wait condition (element not yet present) | Often — retry gives app time to reach ready state | Add explicit wait; remove retry dependency |
| Brittle selector no longer matching target element | No — same selector fails on retry | Update locator; use self-healing if available |
| Genuine application race condition | Sometimes — produces a false pass | Investigate and fix the application defect |
| Test order dependency (shared state contamination) | Sometimes when isolated retry does not carry contaminated state | Fix test isolation; remove state dependencies |
| Application feature change breaking test expectations | No — same assertion fails on retry | Update test expectations to match new behavior |
The table above illustrates the core distinction: retries help when the failure cause is external and transient. They suppress failures when the cause is internal to the application or the test. The risk of liberal retry policies is that all seven failure types above produce the same aggregate pass rate metric when the retry policy is permissive enough. The only way to identify which category a repeated failure belongs to is to examine the failure details, not the aggregate pass rate.
Playwright supports retry configuration at the test level and the project level via playwright.config.ts. Setting retries: 2 in the project configuration retries every failing test up to twice before reporting it as failed. Playwright reports tests that fail at attempt 1 but pass on retry as “flaky” in the HTML report — not as passes — which is a useful distinction, but only if the team monitors the flaky count rather than treating it as equivalent to green.
Jest supports retry via jest-circus with the testEnvironmentOptions retry configuration, and Cypress supports per-mode retry counts in cypress.config.js, with separate settings for CI and interactive mode. All three frameworks allow retry to be set at the global, file, or individual test level, which supports a targeted policy where tests that interact with documented non-deterministic dependencies have explicit retry counts and stable tests have zero retries configured.
A retry policy with zero retries for most tests, and explicit per-test retry counts for tests with known external dependencies, produces a suite where the flaky test list is short and meaningful. This requires more upfront classification work than a global retry count, but produces a quality signal that reflects the actual pass rate of each test rather than the pass rate after retry suppression. For teams with large suites where upfront classification is impractical, starting with retries: 1 globally while monitoring the flaky test report weekly identifies which tests regularly consume retries and prioritizes them for investigation.
The primary audit method is examining retry consumption rate by test. Most CI platforms and test reporting tools expose per-test attempt counts across runs: the number of times a test was executed before it passed or was finally marked failed. A test that requires two or three attempts in a significant proportion of its runs is not passing because the condition it tests is reliable; it is passing because the retry policy is wide enough to absorb its instability. Sorting tests by average attempt count over a two-week period identifies the candidates that need investigation first.
The secondary audit method is comparing pass rates at attempt 1 versus attempt 2 and beyond. In a well-configured suite where retries handle genuine transient external conditions, the pass rate at attempt 1 should be above 95% for tests that interact only with internal application components. A test that fails at attempt 1 in 30% of runs and passes attempt 2 in 60% of those failures has a real first-attempt pass rate of approximately 70%, not the 100% that the suite-level report reflects when retries are counted as passes. This gap is invisible unless per-attempt data is tracked explicitly.
The third method is environment comparison. A test that fails at attempt 1 consistently in one CI environment and passes consistently in another without retry is surfacing environment configuration differences rather than transient conditions. This pattern indicates an implicit environmental dependency that should be made explicit — by fixing the environment configuration or by adding setup steps that establish the required state before the test runs. For teams that lack detailed per-attempt reporting in their current tooling, the QA outsourcing guide covers how external QA specialists can instrument existing suites to surface retry consumption data. The Astaqc software testing services team provides test suite audits that include retry consumption analysis as a standard component.
Retry policy should be calibrated to the test layer and the external dependency profile of the tests in that layer. Unit tests, which have no external dependencies and are fully deterministic, should have zero retries — a failing unit test always indicates either a defective application function or a broken test. Component tests, which mock external dependencies, should also have zero retries: every failure indicates a component rendering defect or a test setup problem, neither of which a retry addresses. Integration tests, which interact with real external services, databases, or message queues, may warrant a single retry for genuinely transient infrastructure failures, with a logged record of which tests consumed the retry.
End-to-end tests occupy the most complex position in the retry decision. They interact with real browsers, real backends, and real external services, all of which can produce transient failures that do not reflect the application’s actual behavior. A retry count of one for E2E tests, combined with regular monitoring of which tests regularly consume the retry, is a practical starting point. E2E tests that consume a retry in more than 10% of their runs should be investigated rather than given a higher retry count. The retry is surfacing a test that is structurally unstable; giving it more retry attempts does not address the structure.
Smoke tests and scheduled production tests — tests that run against a live production environment to detect issues before real users encounter them — have a different profile. These tests encounter real production variability and may warrant a slightly higher retry count or a longer delay between attempts. However, even production smoke tests should log retry consumption and alert when a test consistently requires multiple attempts, because a test that regularly fails at attempt 1 may be detecting a genuine production stability issue rather than test infrastructure noise.
For teams designing retry policies from scratch, the complete guide to software testing covers how different test layers relate to different quality goals and risk tolerance levels. Teams that want to establish a retry policy as part of a broader test automation investment can work with Astaqc’s QA team to design a suite configuration that maintains high signal quality without suppressing genuine defects through retry accumulation.
One retry is the practical maximum for most E2E test suites before the policy starts masking real instability rather than tolerating genuine transient conditions. A suite where most tests pass on attempt 1, and a small proportion — under 5% — occasionally need a second attempt, is operating within the intent of retry tolerance. If the proportion of tests requiring a second attempt is consistently above 5–10%, the retry policy is suppressing instability that warrants investigation. Two or more retries are appropriate only for tests with documented non-deterministic external dependencies, with explicit justification per test rather than a global configuration.
Yes, significantly. Each retry attempt re-executes the full test, including setup and teardown. A test with a 30-second execution time and one retry configured can consume 60 seconds in the worst case. For large suites with high retry consumption rates, the cumulative effect on pipeline duration can be substantial. This is a second reason to minimize the scope of retry beyond quality signal integrity: liberal retries also slow CI feedback loops. Tracking retry consumption time as a separate CI metric alongside total test execution time makes this cost visible rather than buried in aggregate build duration.
A flaky test is one whose failure cause is internal to the application or the test — a brittle selector, a missing wait condition, a test order dependency, or a genuine application defect that surfaces non-deterministically. A test that legitimately needs retry is one whose failure cause is external and genuinely transient — network jitter from a third-party dependency, CI runner resource contention. The distinction requires examining failure logs: if the failure occurs at the same step with the same error message across multiple runs, it is likely internal and fixable. If it occurs at different steps or with different messages correlated with external service availability, it is a retry candidate.
Tests that read from or write to a shared database are vulnerable to test order dependencies: a test that leaves unexpected state can cause subsequent tests to fail in ways that retry does not fix, because the retry does not reset the database state. For these tests, the first priority is isolating each test’s data setup and teardown so that database state does not persist between test runs. Retry is not a substitute for proper test isolation — it will occasionally produce a pass when the database state happens to resolve between attempts, but it will not do so consistently.
In Playwright, Cypress, and Jest, retry counts can be configured at the test level, the file level, and the global level. This enables a targeted policy: tests with known non-deterministic dependencies get a retry count appropriate for those dependencies, while all other tests run with zero retries. Playwright’s test.retry() annotation allows per-test retry configuration without changing the global setting. Implementing targeted retry requires classifying tests by their external dependency profile, which is itself a useful audit exercise that surfaces which tests have undocumented dependencies on external services.
In parallel test execution setups, a failing test is typically retried on the same worker or a different worker depending on the framework. Failures caused by shared state contamination from a parallel test — two tests writing to the same database row simultaneously, or competing for the same fixture — may pass on retry if the competing test has completed by the time the retry runs. This creates a class of failures that appear transient but are caused by inadequate parallelism isolation. The diagnostic symptom is failures that occur consistently under parallel execution and disappear when tests run sequentially — a pattern that retry policy makes harder to detect because the retry obscures the failure frequency. For teams managing parallel execution at scale, the Astaqc performance testing services team can help assess whether parallel execution configuration is contributing to suite instability.
A retry that passes a failing test does not fix the test — it hides it. The suite reports green while the underlying cause accumulates unaddressed. In 2026, as retry is enabled by default in most CI tooling, the cost of not auditing retry consumption is a quality signal that no longer reflects what is actually breaking in the application.

Sign up to receive and connect to our newsletter