Testing
When Two JUnit Reports Both Contain Four Tests
Use two sample JUnit reports with identical totals to find a new failure, a fix, a persistent failure, a missing test and an added test.
Both runs say four tests ran. Both report two passes and two failures. The totals look unchanged, but one test identity is absent from the current report, another appears for the first time, and a different test now fails. To see what changed, compare the identities and outcomes inside the reports.
Reproduce the comparison
Download baseline.xml and current.xml. Both are UTF-8 reports with synthetic test names and failure messages. You can also copy the examples below into two UTF-8 files.
baseline.xml
<testsuite name="Browser">
<testcase
classname="Checkout"
name=
"redirectExpiredSession">
</testcase>
<testcase
classname="Checkout"
name="exportCsv">
<failure message=
"old sample failure"/>
</testcase>
<testcase
classname="Checkout"
name="refreshToken">
<failure message=
"failed on both fixtures"
/>
</testcase>
<testcase
classname="Checkout"
name="legacySafari">
</testcase>
</testsuite>
current.xml
<testsuite name="Browser">
<testcase
classname="Checkout"
name=
"redirectExpiredSession">
<failure message=
"new sample failure"/>
</testcase>
<testcase
classname="Checkout"
name="exportCsv">
</testcase>
<testcase
classname="Checkout"
name="refreshToken">
<failure message=
"failed on both fixtures"
/>
</testcase>
<testcase
classname="Checkout"
name="rejectEmptyReport">
</testcase>
</testsuite>
- Open Compare JUnit reports.
- Choose baseline.xml under Baseline XML and current.xml under Current XML.
- Select Compare reports and open the Before and after summary.
You can also check the example by hand. Within suite Browser and class Checkout, write out the names from both files and compare each matching outcome. A case with a failure element failed in that observation. A name that does not appear in a file has no outcome in that report.
Failures, errors and skips
A <failure> commonly records a failed assertion. An <error> commonly records an unexpected exception, such as a setup step that throws. A <skipped> records a test identity without a pass or fail result. The exact reporting conventions depend on the runner. ToolDaisy counts failures and errors as failing outcomes when comparing reports. When the test is present in both files and either run skipped it, ToolDaisy shows No comparable result.
What the tool actually reported
The live comparison returned Compared 5 test identities. Each outcome appeared once.
- New failure ·
redirectExpiredSessionpassed in the baseline and failed in the current run. - Fixed ·
exportCsvfailed in the baseline and passed in the current run. - Still failing ·
refreshTokenfailed in both runs. - Missing from current ·
legacySafaripassed in the baseline and is absent from the current report. - Added ·
rejectEmptyReportis absent from the baseline and passed in the current run.
The missing and added test explain how the total stayed at four even though the reports contain different test identities. This tells you which test results appeared in the reports. To measure whether the runs exercised different lines or branches of code, compare their code-coverage reports separately.
Decide what to inspect next
- New failure · Start with
redirectExpiredSession. Read both runs’ configuration and inspect the failing assertion in the current run. - Fixed and still failing · The current
exportCsvobservation passed andrefreshTokenstill failed. Preserve the two observations when sharing the result. - Missing · Find out why
legacySafaridisappeared. Compare the test filters, browser matrix, shard outputs and report-merge step. A rename or move can also change the suite, class or test name used for matching. - Added · Check whether
rejectEmptyReportwas newly added or ran under a different selection in the current build.
Match suite path, class and test name together. When a report contains duplicate identities, inspect those cases individually before deciding what changed. Use repeated runs under comparable conditions to assess flakiness.
For a review comment, include the name of each changed or absent test and the run IDs. That gives the next person something concrete to check even if the top-level counts are identical.