QA practice8 min readUpdated 2026-11-23By

Flaky tests in outsourced automation: who owns them and how to measure

A flaky test (a test that gives both a pass and a fail on the same commit, environment version and test data version) should be counted from stored results of every attempt, and a pass on automatic retry is a flaky event even when the build ends green. In outsourced automation this site proposes that the vendor owns flakiness caused by the test code it maintains, and the buyer owns flakiness caused by the product, the environments and the pipeline it runs. One data set serves both sides, because the cause decides who fixes the test and who pays for the hours.

On this page
  1. Why retries hide the number a buyer needs
  2. How to measure flakiness so both sides get the same number
  3. Who owns which flaky test: the ownership matrix
  4. Quarantine rules with a deadline
  5. Who pays for the repair hours

Why retries hide the number a buyer needs

A green build is not evidence of a stable suite, because a framework can retry a failing test and still let the build pass. Playwright does not retry failing tests by default; with retries on, it reports a test that failed first and passed later as flaky ev-content-flaky-001confidence A. Maven Surefire, with its rerun count set above zero, counts a test that fails first and passes on a rerun as flaky, and the build is successful unless a separate flake limit is set and exceeded ev-content-flaky-002confidence A. Cypress sets retries to zero by default, and its cloud product has a filter for tests that retried and then passed ev-content-flaky-003confidence A.

Payment can make the gap worse. A vendor paid on pipeline pass rate could raise it by adding retries, without fixing a test.

The published figures read for this article describe specific repositories. Atlassian states that flakiness was in the past responsible for as much as 21% of master build failures in its Jira Frontend repository, and it attributes approximately 15% of Jira backend repository failures to flaky tests ev-content-flaky-006confidence B. A 2026 preprint on 1,960 open-source Java projects using GitHub Actions reports that 3.2% of builds were rerun, and that 67.73% of the rerun builds left after excluding reruns caused by the workflow approval mechanism were flaky ev-content-flaky-008confidence B. A flaky build in that study can come from network or dependency failures as well as from flaky tests ev-content-flaky-008confidence B. Neither source is a benchmark for an outsourced suite. They show that the numerator and the denominator have to be written down before two numbers can be compared.

The test automation page cites what a research program on software delivery says about tolerating flaky tests. A contract needs something narrower: a number both sides can compute.

How to measure flakiness so both sides get the same number

The method below is this site's working definition. It produces three figures from one data set: the flaky test rate, the vendor's rate and the disrupted build share. It uses no vendor tool, and either side can rerun it on the stored results. The article on metrics to track with a vendor uses the rate by reference.

Two choices are fixed in writing before the first run: the window and the repeat count. This method uses one window, a full release cycle, for all three figures and every report. A team without a release cycle names a calendar month instead and keeps to it, because a window with one quiet week and one release week mixes two different loads.

  1. Store every attempt, not the final verdict

    Each record holds the test identifier, commit, attempt number, result, duration, environment version, test data version, runner and start time. The environment version includes the browser or device model. With reruns enabled, Surefire's report has elements that hold information on the failing runs of a flaky test ev-content-flaky-002confidence A; the pipeline adds whatever field a framework does not write. The result store belongs to the buyer or is exported to it after each run.

  2. Fix the test identifier

    A renamed or moved test keeps its history through a mapping file in the repository. Without the mapping, renaming an unstable test resets its record. A test that runs with several sets of input values is counted per set, and the same rule applies in every report.

  3. Define the flaky event

    A flaky event is recorded when one test gives at least one pass and at least one fail on one commit, with the same environment version and test data version. However many times the test flips on that combination, it is one event. The results may come from automatic retries, manual reruns or scheduled runs. A test that fails every attempt on the combination is a failure, not a flaky event.

  4. Run a scheduled repeat on an unchanged commit

    Pipeline history only shows instability that happened to be observed. A nightly job reruns the whole suite on the last release commit, with a repeat count for the window fixed in advance. More repeats give a test more chances to flip, so rates with different repeat counts are not comparable. The job uses the same runner type and parallel settings as the release pipeline, because instability caused by load may not appear in a serial run. Without this job, many tests with two attempts can be there only because they failed and were retried, which can inflate the rate.

  5. Compute the flaky test rate

    Divide the number of distinct tests with at least one flaky event in the window by the number of distinct tests with at least two attempts in that window on the same commit, environment version and test data version. Tests without two such attempts are excluded, because they had no chance to flip. A quarantined (set aside so that its result no longer blocks a build) test is counted like any other as long as the repeat job runs it. A test that is skipped in the repeat job as well is listed by name as not measured. The report prints both counts, the window and the repeat count beside the rate.

  6. Classify the cause of each event

    Each flaky event receives one cause from the ownership matrix, with the evidence for it. An event without a cause after the agreed triage time goes to joint triage. "Unknown" stays visible in the report as its own line and is never spread over the other causes.

  7. Compute the vendor's rate

    Divide the number of distinct tests in the vendor-maintained suites with at least one event whose fix owner is the vendor by the tests of those suites in the flaky test rate's denominator. Events with a buyer-owned cause are not in the numerator. Tests with only unknown events are printed beside the rate and counted for neither side.

  8. Compute the disrupted build share

    Divide the pipeline builds that turned red, or needed a retry to turn green, only because of flaky events by all pipeline builds in the window. The nightly repeat runs are in neither number. A suite with few flaky tests can still disrupt many builds if those tests sit in the short set of checks every build must pass.

  9. Report age and concentration

    The weekly report lists counts only: tests with flaky events so far, quarantined tests, tests not measured and the age of the oldest quarantine entry. The three figures are printed once, when the window closes. A falling rate with a growing list of tests not measured means that tests are leaving the measurement.

Baseline collection before any vendor starts is described in the QA audit article.

Who owns which flaky test: the ownership matrix

The author of a test is not always the owner of its instability. The matrix is this site's proposal and assigns each cause to the side that can change the thing that causes it. It assumes that the vendor maintains test code and the buyer runs the product, environments and CI (continuous integration, the automated pipeline that builds and tests every code change); where a vendor hosts the environment, those rows move to the vendor. One row uses a stub (a stand-in that returns fixed answers in place of a real service).

Flaky test ownership matrix for a vendor-maintained suite on buyer-run environments (this site's proposal)
CauseSignal to look for in the stored resultsFix ownerVendor's partIn-house team's part
Fixed waits and weak element locatorsFails at the same step on many commits; duration close to a timeoutVendorRepairs the test inside the maintenance scopeProvides stable element identifiers on request
Order dependence and leaked statePasses alone, fails after a specific other testVendorIsolates setup and cleanup; runs the suite in shuffled orderNone, unless product state cannot be reset
Test data collisionFails only when two runs overlapSide that owns the data setupGenerates unique data per run where the interface allows itProvides a data reset or seeding interface
Timing fault in the productSame wrong outcome reproduced by hand or in logsIn-house developmentFiles a defect with both attempts attached; keeps the testFixes the product; the test leaves the flaky list when the fix ships
Environment instabilityMany unrelated tests flip in the same time windowIn-house platform teamGroups the events under one incident numberRestores the environment and publishes the outage window
Pipeline capacityFlips rise with parallel jobs and are rarer in serial runsOwner of the runnersReports the load at which flips beginAdds capacity or lowers parallelism
Third-party serviceFailures match the service's error responsesVendorProposes a stub and a separate contract check, then builds bothApproves which calls may be replaced by a stub
Device or browser providerRepeated attempts flip on one device model or browser version and not on the othersHolder of the provider accountReproduces on a second device before filingOpens the support case if it holds the account
Cause unknown after triage timeNo single signal dominatesTriage lead named in the contractSupplies attempts, logs and recordings of the failing runSupplies application and infrastructure logs for the same times

Two rows need a written rule in advance. A timing fault in the product can look like a weak test until somebody reproduces it, and each side then has a reason to prefer the other's explanation. The proposed rule is evidence first: a test whose failing attempt shows a wrong product state is a product defect, and lengthening its wait requires the buyer's approval in the review.

Environment instability is the other. When unrelated tests flip together, the events belong to one incident. They stay in the flaky test rate and the disrupted build share and do not enter the vendor's rate, so the buyer still sees what its own environment costs.

Quarantine rules with a deadline

A quarantine needs an end date and an owner, or a test can stay out of use without a decision to drop it. One public policy shows what a deadline looks like: GitLab's handbook allows 3 days for fast quarantine and 3 months for long-term quarantine, asks the owning team to acknowledge within 48 hours, and then schedules the test for deletion ev-content-flaky-005confidence A. Its own suite also retries a failing test once, in a separate process ev-content-flaky-004confidence A. Atlassian describes another setup: its tool opens a ticket with a deadline for the owning team and keeps running quarantined tests until they stay healthy for a configured period ev-content-flaky-007confidence A.

These are in-house policies, so an outsourced team needs three additions. The contract names who may quarantine a test, since a vendor that can silence its own failing tests controls its own score. It names the behavior that loses coverage during quarantine and who runs the manual check. It also states that deletion needs the buyer's written approval, with the requirement that the test covered.

The exit rule needs a root cause as well as a run count. GitLab's process gives two alternative ways out of quarantine: the test passes consistently in more than 100 local runs and its root cause is identified and fixed, or the test is removed or replaced with better coverage; a plan to monitor the test for 1 week goes with them ev-content-flaky-005confidence A. By arithmetic, a test that fails independently in 1% of runs still passes 100 consecutive runs about 37% of the time, and needs 299 passing runs before that chance falls below 5% ev-content-flaky-009confidence B. One green rerun is weaker evidence than either count, so the note that closes a flaky ticket should name the cause and the change.

Who pays for the repair hours

Under this site's proposal, payment follows the fix owner in the matrix, and the pricing model decides how the contract says it. Under a fixed monthly fee for a maintained suite, the contract can place the vendor-owned rows inside the fee and log the buyer-owned rows as hours with an incident number. Under time and materials (a pricing model that bills the hours worked), it can state that repairs of tests delivered within an acceptance period are not billable when the cause is a vendor row.

Two rows need their own line. Third-party events count for the vendor only once the buyer has approved the stub, and hours before that approval are the buyer's. On unknown causes each side carries its own hours until the triage lead assigns one.

The party that classifies the cause may gain from the result. A buyer can therefore review a sample of classifications each month using the stored attempts. Disputed events go to the triage lead, and the decision is written into the ticket.

The stability row in the service level article is where a target for the vendor's rate would be written. The order is measurement first, target second: a target signed before one full window of data exists has no measured starting point. The exit case is separate, and the automation handover article covers what happens to the quarantine list when the suite moves in-house.

A buyer comparing proposals can ask each bidder to fill in the fix owner column for the buyer's own setup and to state which attempts its reports store. The request template guide holds the general question on flaky tests.

Questions buyers ask

Should a vendor be allowed to use automatic retries?

Yes, if every attempt is recorded and a pass on retry is counted as a flaky event. Retries that overwrite the first result remove the evidence that the test is unstable.

Is a flaky test always a defect in the test code?

No. A timing fault in the product, a shared environment or a starved pipeline machine can produce the same symptom, so the cause has to be classified before the fix is assigned or billed.

Can a buyer measure flakiness without access to the vendor's pipeline?

Not reliably. The method needs the result of every attempt with its commit and environment, so the result store should belong to the buyer or be exported to it after each run.

Related guides and pages

Scores are computed from the published methodology using the evidence linked on this page as of the verification date shown. Rate bands are vendor-published or directory-listed ranges, not quotes. This site does not accept payment for inclusion, position or badges, and does not recommend any vendor outside the scenarios stated on the page.