Class JUnitXmlFormatter

java.lang.Object
org.ek9lang.cli.JUnitXmlFormatter
All Implemented Interfaces:
TestResultFormatter

final class JUnitXmlFormatter extends Object implements TestResultFormatter
JUnit XML test output formatter (-t3). Compatible with Jenkins, GitHub Actions, GitLab CI, and other CI/CD tools.

Produces standard JUnit XML format with EK9 test type extensions:


<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="test.module" tests="4" failures="1" errors="0" skipped="0" time="0.010">
  <properties>
    <property name="ek9.types.assert" value="1"/>
    <property name="ek9.types.blackbox" value="1"/>
    <property name="ek9.types.parameterized" value="2"/>
  </properties>
  <testcase name="SimpleTest" classname="test.module" time="0.003">
    <properties>
      <property name="ek9.test_type" value="assert"/>
    </properties>
  </testcase>
  <testcase name="ParamTest [case: hello]" classname="test.module" time="0.004">
    <properties>
      <property name="ek9.test_type" value="parameterized"/>
      <property name="ek9.case_id" value="hello"/>
    </properties>
  </testcase>
</testsuite>

  • Constructor Details

    • JUnitXmlFormatter

      JUnitXmlFormatter()
  • Method Details

    • reportDiscovery

      public void reportDiscovery(List<DiscoveredTest> tests, PrintStream out)
      Description copied from interface: TestResultFormatter
      Report the discovery of tests before execution begins.

      The discovery report should include:

      • Test type breakdown (assert-based vs blackbox vs parameterized)
      • Total test case count (including parameterized cases)
      • Group information if applicable
      Specified by:
      reportDiscovery in interface TestResultFormatter
      Parameters:
      tests - The discovered tests with metadata
      out - The output stream
    • reportExecutionStart

      public void reportExecutionStart(int testCount, PrintStream out)
      Description copied from interface: TestResultFormatter
      Report that test execution is starting. Some formatters may output a progress message here.
      Specified by:
      reportExecutionStart in interface TestResultFormatter
      Parameters:
      testCount - The number of tests to execute
      out - The output stream
    • reportResults

      public void reportResults(List<TestResult> results, PrintStream out)
      Description copied from interface: TestResultFormatter
      Report all test results after execution completes.
      Specified by:
      reportResults in interface TestResultFormatter
      Parameters:
      results - The test results
      out - The output stream