JUnit XML reports in the Tripwire dashboard

Almost every test runner can write JUnit XML: Maven Surefire, Gradle, pytest, Jest, Go, .NET and more. If your product accepts it, you support nearly everyone. Here's how its elements map to Tripwire.

Field mapping

How JUnit XML's data maps to the kit's Run and TestCase type. Your backend does this mapping and serves the result to the kit. The kit itself doesn't call JUnit XML. Check field names against JUnit XML's documentation for the version you use.

JUnit XML fieldKit fieldNote
<testsuite tests>Run.totalSum across testsuite elements
<testsuite failures> + <testsuite errors>Run.failedTreat errors as failures, or show them separately
tests − failures − errors − skippedRun.passed
<testsuite time>Run.durationMsSeconds in the XML; multiply by 1000
<testsuite name>Run.suite
<testsuite timestamp>Run.startedNot every runner writes it
<testcase classname>.<testcase name>TestCase.nameMatches the kit's sample names like CheckoutTest.payWithSavedCard
<testcase time>TestCase.avgMsAverage across runs, in milliseconds
<failure> or <error> childTestCase.lastStatus = failedKeep the message for the evidence list
<skipped> childTestCase.lastStatusSkipped tests don't count toward pass rate
<flakyFailure> (Maven Surefire)TestCase.history 'r'Written when a test fails, then passes on rerun

The format in brief

A report is a <testsuites> element with one or more <testsuite> elements. Each suite has counts (tests, failures, errors, skipped) and a time in seconds, and contains <testcase> elements with a name, classname and time. A failing test case has a <failure> or <error> child; a skipped one has <skipped>.

  1. Your CI step collects every XML file the runner wrote.
  2. It uploads them in one request with the branch, commit, author, trigger and environment.
  3. Your backend parses them into one Run and updates each TestCase.

Java teams

With Maven, Surefire writes target/surefire-reports/TEST-*.xml. With TestNG, the same Surefire output works, and TestNG also writes its own testng-results.xml if you need groups or parameters.

Questions

Is JUnit XML a formal standard?

Not quite. It's a widely shared format with small differences between tools, so parse defensively and treat unknown attributes as optional.

How do I get flaky data from JUnit XML?

Maven Surefire and Failsafe add flakyFailure elements when rerunFailingTestsCount is set. Other runners need their own retry plugins, or you can compare results across runs.

Can one run have several XML files?

Yes, most runners write one file per suite or module. Combine them into one Run on upload.