Surefire · Gradle · pytest · Jest · gotestsum · Playwright · Cypress

JUnit Flaky Test Analyzer

Drop the JUnit XML reports from many CI runs, loose or zipped, to find tests that pass and fail on the same code. The page ranks them with the evidence behind each verdict, times every test, groups failures by message and exports a quarantine list.

Reports

Drop XML or ZIP files

Up to 20,000 runs, 80 MB per report

Or choose a folder of reports

Reports in one folder, or with one run id in their path, form one run

Commit, branch and run id are read from the path (the exact patterns are under Runs and checks) or from the manifest, which wins. ZIP files are unpacked with a size cap and nested ZIPs are not opened.

Choose reports, or press Example, to see the analysis.

JUnit Flaky Test Analyzer

Operator: Abdulla Al Fahad. How tools are built and checked

A test that failed last night is not necessarily flaky: it may have been broken by the commit it ran on. The two look the same in one report and different across many, which is why the useful question is whether a test gave both results on code that did not change.

Drop the JUnit XML files of many CI runs, loose or zipped, and the page builds a history per test, ranks the suspects with the evidence behind each, times every test, groups failures by message and exports a quarantine list.

Key features

  • Tests that passed and failed on the same commit, and tests Surefire reports with flakyFailure or rerunFailure children, ranked ahead of everything else
  • Intermittent tests across commits, with separate failure episodes, flip rate and a Wilson 95% interval on the failure rate
  • Tests that fail at the end of the history are shown as failing, not flaky, with the first failing run
  • Duration percentiles (p50, p90, p95), a trend ratio per test and the slowest suites
  • Failure clusters by message and stack with numbers, hex ids, paths and timestamps removed

How runs are built and what counts as flaky

JUnit XML has no single schema. The reader accepts testsuite and testcase elements wherever they sit, takes failure, error and skipped children, counts flakyFailure, flakyError, rerunFailure and rerunError as retries, and lists any other element it met and ignored. A test written twice in one report counts as a retry: a failure followed by a pass is a pass after retry.

All reports in one folder, one ZIP, or sharing a run id in their path form one run. Commit, branch and run id come from the optional manifest CSV (columns file, commit, branch, run_id, time) and otherwise from the path: the commit is the first 7 to 40 character hex token with a letter a to f and a digit, the run id is run, build, job, attempt or ci followed by digits, and the branch is branch- or branch= followed by a name.

A test is identified by classname plus name. A renamed test is a new test with a new history.

How it works

Runs are ordered by their timestamps when every run has one, and by file name in natural order otherwise. For each test the page walks its pass and fail results in that order, ignoring skips, and counts flips between neighbouring results, separate failure episodes and the failing streak at the end.

Flaky on the same code needs a pass and a fail on one commit, or a pass after a retry inside a run. Unchanged code should give one result, so a mix is nondeterminism; infrastructure failures are counted as part of it. Intermittent needs at least two failure episodes, enough results and a flip rate above the threshold, and it is weaker evidence because the code changed between runs.

The failure-rate interval is the Wilson score interval at 95%. The flip rate is flips divided by results minus one and is descriptive; the page runs no hypothesis test and states no p-value. Clusters group distinct normalised messages whose three-word shingles overlap by at least 60%, checked with MinHash and then with the exact Jaccard similarity.

When this helps

  • A release engineer who downloads the artifacts of the last 60 nightly runs lists every test that gave both results on an unchanged commit and puts exactly those on the quarantine list, with the commits as evidence.
  • A developer sees a test red on a pull request, loads the last 30 runs of the main branch, and finds it is failing since one run: a regression, not a flake to retry.
  • A team lead sorts durations by 95th percentile and finds the one test whose median doubled over 24 runs.
  • A QA analyst groups the failures of a Playwright suite by message and sees how many share one timeout text and which tests they come from, instead of reading them one by one.

Opening a file

  1. Drop XML or ZIP files, or choose a folder; add a manifest if the paths do not carry commits.
  2. Press Analyse reports, after adjusting the flip rate and minimum results if the defaults of 0.1 and 5 do not fit, and look at the failing-tests-per-run chart for the shape of the history.
  3. Read the quarantine tab; each row says why the test is there.
  4. Export the CSV or JSON quarantine list, or the workbook with durations, clusters and per-run checks.

Example

The Example button: 96 report files forming 24 runs of a Maven project over 8 commits, three CI runs per commit

PaymentServiceTest.retriesOnTimeout fails in runs 4, 13, 14 and 20; OrderRepositoryIT.concurrentUpdate passes after a Surefire flakyFailure in runs 5, 12 and 19; CheckoutTest.appliesCoupon fails from run 19 on; SearchIndexTest.rebuild slows from 2 to 5 seconds.

Verdicts for the 8 tests and 192 results

retriesOnTimeout failed 4 of 24 (16.7%, Wilson 95% interval 6.7% to 35.9%), flipped 6 times and had both outcomes on 3 commits: flaky on the same code. concurrentUpdate shows 3 runs that passed after a retry: also flaky. appliesCoupon is failing (6 failures, all at the end), not flaky. rebuild has p50 3.63 s, p95 4.97 s and a trend of 1.55 times. The 10 failures fall into 3 clusters of 6, 3 and 1.

Limits

A test that only ever ran once, or only on commits that were run once, cannot show both outcomes on the same code. Absence from the quarantine list is not evidence that it is stable.

Paths without a commit token give the page no same-commit evidence. Only retries inside a run and the weaker cross-commit rule then apply, and the Runs and checks tab shows commit as n/a.

Each report's tests, failures, errors and skipped attributes are compared with the cases found. Some reporters count suites differently, and a mismatch is a note, not a failure of the analysis.

  • A manifest is worth writing when run ids are not in the paths: three columns (file, commit, run_id) are enough, and a folder name in the file column matches every report in it.
  • Raise the minimum results to 10 for suites with long histories so that two bad nights do not make a test intermittent.

Common errors and how to fix them

has no <testsuite> or <testcase> element
The XML is not a JUnit report. Coverage and other XML files in the same folder are listed under Files not read.
contains a DOCTYPE or ENTITY declaration
The page refuses such files because entity declarations can expand into very large text or point at other files. Remove the declaration from the report or regenerate it.

Best practices

  • Quarantine, do not delete: move the test to a separate job that still runs, and re-analyse after a fix to see whether new results stop showing both outcomes.
  • Keep reports from reruns of the same commit; they are the best evidence there is.
  • Name the export after the date range so a later list can be compared with it.

Where this sits next to the CI tools

CI services and test-reporting products add integration with your pipeline and store history for you. This page works on reports you have downloaded, which makes it suitable for a one-off audit, an air-gapped project or a first look before you adopt a service.

Frequently asked questions

How does it tell a flaky test from a broken one?

By what the history looks like. Both outcomes on one commit, or a pass after a retry, is flaky. A single block of failures that runs to the end of the history is failing. Two or more separate episodes with passes between them is intermittent, which is weaker evidence.

Why is a test with zero failures listed as flaky?

It passed after Surefire retried it. The report records a flakyFailure child on a passing test case, so the run shows both an attempt that failed and the final pass.

What does the Wilson interval tell me?

The range of failure rates that fit the observed counts at 95% confidence. 4 failures in 24 results gives 6.7% to 35.9%, so the true rate could be small or large; a wide interval means too few runs to rank two tests against each other.

Can it open JUnit files inside nested ZIPs?

No. A ZIP is unpacked one level, with a limit on the total bytes that come out. Unzip an archive of archives first.