Package io.karatelabs.output
Class JunitXmlWriter
java.lang.Object
io.karatelabs.output.JunitXmlWriter
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="tags" value="@smoke,@api"/>
<property name="requirements" value="REQ-1,REQ-2"/>
</properties>
<system-out>step logs</system-out>
<failure message="error">stacktrace</failure>
</testcase>
</testsuite>
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringfeatureToXml(FeatureResult result) Convert a single feature result to JUnit XML string.static StringfileNameFor(FeatureResult result) File name this feature's output is written under.static StringserializeFeature(FeatureResult result) Serialize a feature result to its XML text.static voidwriteFeature(FeatureResult result, Path outputDir) static voidwriteSerialized(String fileName, String content, Path outputDir) Write pre-serialized content.
-
Method Details
-
serializeFeature
Serialize a feature result to its XML text.Separated from the file write so a listener can do this synchronously, while the result is still whole. The suite releases nested
karate.call()trees once a feature's listeners have returned, and this output flattens called features' steps into its own — so serializing on a background thread would silently drop them. -
fileNameFor
File name this feature's output is written under. -
writeSerialized
Write pre-serialized content. Safe after the source result has been released. -
writeFeature
-
featureToXml
Convert a single feature result to JUnit XML string.- Parameters:
result- the feature result- Returns:
- XML string
-