Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+23 more

    JUnit Run Compare

    by Hale Sinclair

    1

    A red run often fails for reasons that were there before the pull request.

    $5

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    JUnit Run Compare

    JUnit Run Compare

    Example session with this skill installed

    Compare our main branch's test report base/report.xml with the pull request's two reruns head/run-1.xml and head/run-2.xml: what got worse, what is flaky, and what should block the merge?

    • Read your context and instructions
    • Compiled the junit run compare

    Sample result: a pull request's test reports compared with main's (the demo, synthetic)

    Summary. VERDICT: FAIL 3. One base report, two reruns of the pull request. 9 tests matched on both sides, 1 only in
    base, 2 only in the pull request; nothing unread. Three things got worse: test_refund now fails, the new test_tax_rounding
    fails, and test_legacy_csv did not run at all. Four need a look: test_currency failed in one rerun and passed in the
    other, test_webhook_sign is skipped now, test_invoice_pdf went from 0.4 s to 1.9 s, and test_retry_backoff was already failing.

    The result (compare.txt)

    base run 1  base.xml: 10 testcase elements (an independent count): 10 read, 0 NOT READ
    head run 1  head-1.xml: 11 testcase elements (an independent count): 11 read, 0 NOT READ
    head run 2  head-2.xml: 11 testcase elements (an independent count): 11 read, 0 NOT READ
    
    FAIL    missing  pytest > tests.test_billing > test_legacy_csv  pass -> absent  base.xml:7
    FAIL    new-test-fails  pytest > tests.test_billing > test_tax_rounding  absent -> fail  head-1.xml:13
    FAIL    newly-fails  pytest > tests.test_billing > test_refund  pass -> fail  head-1.xml:4
    REVIEW  flaky  pytest > tests.test_billing > test_currency  pass -> flaky (failed in: head-2.xml:6)  head-2.xml:6
    REVIEW  skipped-now  pytest > tests.test_hooks > test_webhook_sign  pass -> skip  head-1.xml:9
    REVIEW  slower  pytest > tests.test_billing > test_invoice_pdf  pass -> pass 0.400 s -> 1.900 s  head-1.xml:5
    REVIEW  still-fails  pytest > tests.test_billing > test_retry_backoff  fail -> fail  head-1.xml:8
    INFO    fixed  pytest > tests.test_billing > test_old_bug  fail -> pass  head-1.xml:7
    INFO    new  pytest > tests.test_billing > test_new_api  absent -> pass  head-1.xml:14
    
    rows: 9 (fixed 1, flaky 1, missing 1, new 1, new-test-fails 1, newly-fails 1, skipped-now 1, slower 1, still-fails 1)
    cases matched on both sides: 9; only in base: 1; only in head: 2; not compared: 0
    NOT READ: 0
    DIFFERS BUT NOT COMPARED (text the tool does not judge): 0
    VERDICT: FAIL 3
    

    What to do

    • test_refund (newly-fails, head-1.xml:4): read the failure message at that line; it passed on main, so the change broke it.
    • test_tax_rounding (new-test-fails): a test the pull request added fails in both reruns. Fix it before merging.
    • test_legacy_csv (missing, base.xml:7): it ran on main and in neither rerun. If the pull request deleted it on purpose,
      say so in the review; if not, check that the test file is still collected.
    • test_currency (flaky): failed once in two reruns. Its pass proves little; quarantine or fix it.
    • test_webhook_sign (skipped-now): read the skip reason; a skip added to silence a failure is a failure.
    • test_invoice_pdf (slower, 0.4 s -> 1.9 s, means over the runs): rerun to rule out a busy machine, then profile.
    • test_retry_backoff (still-fails): not caused by this change, but it hides any new failure of the same test.

    The pull request made good (head-ok.xml)

    base run 1  base.xml: 10 testcase elements (an independent count): 10 read, 0 NOT READ
    head run 1  head-ok.xml: 11 testcase elements (an independent count): 11 read, 0 NOT READ
    
    REVIEW  still-fails  pytest > tests.test_billing > test_retry_backoff  fail -> fail  head-ok.xml:9
    INFO    fixed  pytest > tests.test_billing > test_old_bug  fail -> pass  head-ok.xml:8
    INFO    new  pytest > tests.test_billing > test_new_api  absent -> pass  head-ok.xml:14
    
    rows: 3 (fixed 1, new 1, still-fails 1)
    cases matched on both sides: 10; only in base: 0; only in head: 1; not compared: 0
    NOT READ: 0
    DIFFERS BUT NOT COMPARED (text the tool does not judge): 0
    VERDICT: PASS
    

    Next steps

    1. Fix test_refund and test_tax_rounding, restore or explain test_legacy_csv, and run the comparison again.
    2. In CI, run python3 scripts/junitdiff.py base.xml --head head.xml --out compare.txt and fail the step on exit 1.
    3. PASS means no test got worse in the reports read, not that the code is right: failure messages are not compared,
      and a test the runner never wrote to the report cannot be seen.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    The problem

    A green CI run can hide a lot: a test that was not collected, a failure that became a skip, a test that fails one run in three. A red run often fails for reasons that were there before the pull request. Comparing two JUnit-XML reports by eye is slow, and a comparison that skips what it cannot read can say all is well when it read almost nothing.

    What it does

    Your agent runs one standard-library Python script over the JUnit-XML reports of two runs (base and head) and explains the result. The files of one run are its shards and are read together; --run adds a rerun of the same code to a side. A test is the same test only when its suite path, classname and name are equal, never by likeness. Each test whose status changed, or that still fails or got slower, is one row with the rule, the test, the status on each side and the file and line of its test case:

    • FAIL: newly-fails (passed, now fails), new-test-fails (a new test that fails), missing (in base, in no head file).
    • REVIEW: flaky (passed and failed across the reruns of one side, or a Surefire flaky element), still-fails, skipped-now, slower (mean time at least 1.5 times base and at least 0.5 s more; --slower sets the ratio).
    • INFO: fixed, unskipped, new, new-skipped.

    Exit 0 is PASS, exit 1 is FAIL n, INCOMPLETE or NOTHING COMPARED, exit 2 a usage error; --json gives the same result for a CI step. A run that matched no test says NOTHING COMPARED, and names its FAIL rows when it has any. A run with no FAIL row but any file, suite or test case it could not read or compare, any suite whose counts disagree with the cases it holds, or a head that skipped more than half of the matched tests says INCOMPLETE, and the verdict line names every reason: (n of m cases compared; n file(s), run(s), suite(s) or case(s) not read; n suite count(s) disagree; head ran n of m matched cases). With a FAIL row it says FAIL n with the same reasons. It writes only the --out file you name.

    What you get that prompt-only skills don't

    • The rules are a table, not memory. The same reports give the same rows every time; the 11 rules are data the check tests one by one.
    • What was not read is counted and named, with file and line: a file that is not XML, not JUnit, has a DOCTYPE or declares an encoding it does not read; a case with an element, status or result word the script does not know, no name or a time that is not a number of seconds at least 0; and every file's testcase elements are counted a second time by a bare XML pass, so a case the reader did not reach is NOT READ, never silently dropped.
    • A name written twice in one run is not guessed at. Copies of one name (Playwright projects, jest-junit's default suite names, retries) are compared only when every copy agrees; otherwise they are NOT COMPARED, with the copies counted per run.
    • Read on real reports, not only on a demo. 38 real reports, shards and reruns included, were read whole and checked as described below.

    Next to the JUnit skills already listed

    • junit-baseline-delta-review says it will "Compare JUnit XML reports to identify regressions, recovered tests, and missing cases for PR and release audits." Its page says: "Comparison stops on duplicate test keys. Cannot determine flakiness or edit code." This one also compares, and reports flaky tests (several reruns per side), slower tests (times) and every file or case it could not read.
    • junit-flaky-slow-test-reporter reads several runs of one commit and ranks flaky and slow tests. This one compares two sides (before and after a change); it does not cluster failure messages.

    Why pay $5 when EnricoMi/publish-unit-test-result-action is free

    That GitHub Action does more in its place: it posts results as GitHub check runs and pull-request comments, compares with the results of an earlier commit for you, and reads more formats (JUnit, NUnit, XUnit, TRX, Dart JSON). Use it if you live in GitHub Actions. This skill is for the other cases:

    • Offline, anywhere: one standard-library Python file that opens no socket and runs no program, on any two sets of reports you have (claim 1).
    • Shards and reruns per side: a sharded run read as one, several runs of the base and of the head, with a test that passed and failed on one side reported as flaky and the failing run named (claims 4 and 8).
    • file:line on every row, found in its file on every real report (claim 11).
    • Names what it did not read, with its place, and then never says PASS (claim 3).

    How it works

    • The agent finds the base reports (main's CI artifacts, or a run on the base commit) and the head reports, and runs the script.
    • It reads the verdict and the counts first, then each FAIL and REVIEW row, then the NOT READ, COUNTS DISAGREE and NOT COMPARED lists.
    • It says which rows the change caused and which were already there, and it does not rerun or edit tests to make a verdict pass.

    What was checked, and how

    Every number here is read from the check's own output (check.out) when this page is written.

    • 321 regression cases (paths and --out over an input, usage and exit codes, BOM, CRLF, UTF-16, single-byte encodings, Shift-JIS and GBK refused, DOCTYPE refused, not XML, not JUnit, the gate and its reasons, every status and result word known, CTest's notrun by its message, Surefire rerun elements, suite counts, the second count, shards, reruns and copies, times), each shown failing on at least one of 187 deliberately broken copies of the script or the rule table.
    • 11 rules as a data table, equal to the script both ways.
    • 38 real reports written by pytest, mocha, ScalaTest, TestNG, PHPUnit, jest-junit 16 and 17, CTest and Playwright (public projects' reports, and runs of our own small projects split into shards and rerun; reduced only where named in inputs/SOURCES.md): 1997 test cases read, none not read. Four re-encodings of each report (152 runs: BOM, CRLF, UTF-16, one line) gave the same rows; 228 one-fact changes each gave exactly one new row of the planted rule; 10 copies with twelve changes at once each gave twelve rows, one per change; every place of 428 rows was found in its file.
    • A second reading with junitparser, a separate JUnit library, over 262 pairs (the real reports, every planted copy and every rule's example), with the copies rule written from SKILL.md, not from the script: 217 agree; 42 differ only by Surefire flaky elements junitparser does not know and 1 by its rerunFailure example, and 2 by CTest's status="disabled" with no skipped element, which junitparser reads as a pass.
    • Real shards: Playwright and jest-junit runs we split with --shard, when the shards are given as one run (all of a side's files together, without --run): a failure on one shard or one browser is never taken for a flaky test, the same code sharded differently on each side passes, and with the project in the test name a webkit-only failure is a FAIL row (regression cases).

    Known limitations

    • JUnit-XML only. Tested on real reports from pytest, mocha, ScalaTest, TestNG, PHPUnit, jest-junit 16 and 17, CTest and Playwright (mocha's own xunit reporter; mocha-junit-reporter was not tested; it leaves it.skip tests out of the file but in tests=, so such a run is INCOMPLETE); Surefire's flakyFailure and rerunFailure elements only on small reports written for the tests; Go reports were not tested. Gradle is not supported: it writes some test names with object hash codes that change every run, so each such test shows as one missing and one new row.
    • jest-junit writes a test.todo as a test case with no skipped element and leaves it out of the suite's tests= count, so a run with any test.todo is COUNTS DISAGREE and the verdict INCOMPLETE, never PASS: remove the todos (or turn them into test.skip) before comparing.
    • PHPUnit 10 and later name the top suite after the absolute path of phpunit.xml: run base and head from the same directory (the same checkout path), or every test shows as missing and new and the verdict is NOTHING COMPARED, never PASS.
    • It compares statuses and times, not failure messages: a test failing for a new reason in both runs is one still-fails row.
    • A test is its suite path, classname and name, exactly. A name written more than once in one run (copies) is one test only when every copy has the same outcome and each run holds as many; when every head copy fails and no base copy did, it newly fails; otherwise it is NOT COMPARED and the verdict INCOMPLETE. Playwright with several projects writes the project only in a hostname attribute, so every test is copies: set includeProjectInTestName. jest-junit names every suite "undefined" unless its suiteNameTemplate is set to "{filepath}".
    • The files of one run are read together as its shards; reruns of the same code are given with --run. A test that failed in one run and passed in another is flaky; a test absent from a run (a rerun of only the failed tests) is judged by the runs that hold it, but a rerun (a run on a side of two runs or more) that holds no test case at all is NOT READ. Reruns given as shards of one run make copies: NOT COMPARED when they differ.
    • Shards given with --run are read as reruns: a test that fails on one shard or one project then reads as flaky (a REVIEW row) and the verdict can be PASS. A CI job per --shard or per Playwright --project is a shard: give all of a side's files as one run.
    • A runner that writes a retried test again under one name (TestNG, gotestsum --rerun-fails, Gradle retries) makes copies: a failure then a pass on retry is NOT COMPARED, not flaky. pytest-rerunfailures writes a failed attempt as an extra test case, so that suite holds more cases than its tests= says: COUNTS DISAGREE, INCOMPLETE.
    • slower compares mean times; one noisy run can make or hide a slower row. A time with a decimal comma is read, but not a comma followed by three digits (a decimal comma or a thousand separator?); that, a time that is not a number of seconds, or a negative one is NOT READ.
    • A renamed or moved test or suite shows as one missing and one new row.
    • A report written on one line (pytest does) gives line 1 as the place of every case; the test name finds it.
    • REVIEW rows do not fail the verdict, but a head run that skipped more than half of the matched tests is INCOMPLETE (head ran n of m matched cases), not PASS. CTest's notrun is a skip only when every skipped message it holds is a SKIP_RETURN_CODE or SKIP_REGULAR_EXPRESSION_MATCHED message; any other notrun (the test program was not found) is a failure.
    • A file with a DOCTYPE, or declared in an encoding other than UTF-8, UTF-16 and the ASCII-based single-byte code pages (Shift-JIS, GBK, UTF-32, an unknown name), is NOT READ: convert it to UTF-8.
    • It reads reports, not code or commits: it cannot say why a test failed or which change caused it.
    • Names, paths and quoted words in the text report, the --out file and stderr pass one escape: a line break, CR, ESC, a Unicode line separator or a bidi control prints as \xNN or \uNNNN, a backslash as \, so a test name cannot forge a row or the verdict line. The exact names are in --json.

    JUnit-XML only. Tested on real reports from pytest, mocha, ScalaTest, TestNG, PHPUnit, jest-junit 16 and 17, CTest and Playwright (mocha's own xunit reporter; mocha-junit-reporter was not tested; it leaves it.skip tests out of the file but in tests=, so such a run is INCOMPLETE); Go reports were not tested. Gradle is not supported: it writes some test names with object hash codes that change every run, so each such test shows as one missing and one new row. jest-junit writes a test.todo as a test case with no skipped element and leaves it out of the suite's tests= count, so a run with any test.todo is COUNTS DISAGREE and the verdict INCOMPLETE, never PASS: remove the todos before comparing. PHPUnit 10 and later name the top suite after the absolute path of phpunit.xml: run base and head from the same directory (the same checkout path), or every test shows as missing and new and the verdict is NOTHING COMPARED, never PASS. It compares statuses and times, not failure messages: a test failing for a new reason in both runs is one still-fails row. Playwright with several projects writes the project only in a hostname attribute, so every test is copies: set includeProjectInTestName. jest-junit names every suite "undefined" unless its suiteNameTemplate is set to "{filepath}". Shards given with --run are read as reruns: a test that fails on one shard or one project then reads as flaky (a REVIEW row) and the verdict can be PASS. A runner that writes a retried test again under one name (TestNG, gotestsum --rerun-fails, Gradle retries) makes copies: a failure then a pass on retry is NOT COMPARED, not flaky. pytest-rerunfailures writes a failed attempt as an extra test case, so that suite holds more cases than its tests= says: COUNTS DISAGREE, INCOMPLETE. It reads reports, not code or commits: it cannot say why a test failed or which change caused it. The full list is under Known limitations in the description.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed today

    Software
    Python

    No accounts, API keys, database connection or services. Python 3.9+ on the machine.

    Permissions

    Terminal / Shell
    Read Files
    Write Files

    File Scopes

    the
    JUnit-XML
    report
    files
    user
    names
    (read);
    output
    path
    gives
    with
    --out
    Listedtoday

    What's inside

    Creator

    Hale Sinclair

    Hale Sinclair

    9 skills on Agensi

    Frequently Asked Questions

    No. It reads the JUnit-XML files your CI already wrote, opens no socket and runs no program. It needs a base report: a CI artifact from main, or a run on the base commit.

    That no rule of severity FAIL fired, that every file, suite and test case was read, every suite's counts agree with its cases, every test was compared, and HEAD ran (did not skip) at least half of the matched tests. A word the script does not know is NOT READ, never a pass. It is not a promise the code is right: REVIEW rows (flaky, still failing, skipped now, slower) still need a person.

    Yes. All the files of one run (shards, one file per test file) go together; each rerun of the same code is given after --run: a test that passed in one run and failed in another is flaky on that side. A name written twice in one run is compared only when its copies agree, else it is NOT COMPARED and the verdict INCOMPLETE, so give each test a unique name (with Playwright, includeProjectInTestName).

    If it writes JUnit XML, probably; but only the runners named under Known limitations were tested on real reports. Anything it cannot read is listed as NOT READ with its file and line, and the verdict is then INCOMPLETE, not PASS.

    New in Testing & Debugging

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Testing & Debugging.