Class JunitXmlWriter

java.lang.Object
io.karatelabs.output.JunitXmlWriter

public final class JunitXmlWriter extends Object
Generates JUnit XML reports compatible with CI systems (Jenkins, GitHub Actions, etc.).

Output follows the standard JUnit XML schema with per-feature files:

 <testsuite name="feature" tests="N" failures="N" time="secs">
   <testcase name="scenario" classname="feature.path" time="secs">
     <properties>
       <property name="tag" value="@smoke"/>
     </properties>
     <system-out>step logs</system-out>
     <failure message="error">stacktrace</failure>
   </testcase>
 </testsuite>
 
  • Method Details

    • writeFeature

      public static void writeFeature(FeatureResult result, Path outputDir)
      Write JUnit XML report for a single feature.

      Output file is named {packageQualifiedName}.xml.

      Parameters:
      result - the feature result to convert
      outputDir - the directory to write the report
    • featureToXml

      public static String featureToXml(FeatureResult result)
      Convert a single feature result to JUnit XML string.
      Parameters:
      result - the feature result
      Returns:
      XML string