</>TestSignal
Practical interoperability reference

JUnit XML Format Guide

JUnit XML is a widely shared convention, not one perfectly consistent schema. This guide explains the elements a report viewer can safely rely on and the differences it must handle.

Minimal report example

<testsuite name="checkout" tests="2" failures="1" time="0.42">
  <testcase classname="CheckoutTest" name="accepts_card" time="0.12" />
  <testcase classname="CheckoutTest" name="rejects_expired_card" time="0.30">
    <failure type="AssertionError" message="Expected declined status">
      at CheckoutTest.rejects_expired_card(CheckoutTest.java:42)
    </failure>
  </testcase>
</testsuite>

Common elements and attributes

NodePurposeCompatibility note
testsuitesOptional container for multiple suites.Some tools omit it and start with one testsuite.
testsuiteGroups testcases and may publish totals.Summary attributes can disagree with actual children.
testcaseRepresents one test with name, classname, and duration.Identity conventions vary by framework.
failureAssertion or expected-condition failure.Message, type, and stack text are often optional.
errorUnexpected execution or setup error.Some generators use failure for every problem.
skippedMarks a test that did not run.May be an element or reflected only in totals.
system-out / system-errCaptured process output.Can occur at suite or testcase level and can be large.

Why reports differ between frameworks

Maven Surefire, Gradle, pytest, JavaScript reporters, and other test systems all target roughly the same vocabulary but make different choices about nesting, identity, timestamps, properties, captured output, and aggregate totals. A robust viewer should calculate from actual testcase elements and disclose inconsistencies.

Safe parsing rules

  • Reject external entities and doctypes rather than resolving them.
  • Render messages, stack traces, stdout, and stderr as plain text.
  • Keep duplicate test identities instead of silently overwriting them.
  • Preserve source-file context when merging shards.
  • Treat decimal time values as seconds unless the generator documents otherwise.

Validate a report

If a report opens but its totals look wrong, compare suite attributes with the number and status of child testcase elements. TestSignal surfaces those mismatches and uses the testcase records for its own totals.

Open the JUnit XML viewer