Package io.karatelabs.output
Class JsonLinesReportListener
java.lang.Object
io.karatelabs.output.JsonLinesReportListener
- All Implemented Interfaces:
ResultListener
A
ResultListener that streams test results to a JSON Lines (.jsonl) file.
This listener writes feature results as they complete during test execution, enabling:
- Memory efficiency - results written to disk immediately, not held in memory
- Streaming - can tail the file during execution for live progress
- Easy aggregation - multiple JSON Lines files can be concatenated
JSON Lines format:
{"t":"suite","time":"2025-12-16T10:30:00Z","threads":5,"env":"dev","version":"..."}
{"t":"feature","path":"features/users.feature","name":"User Management","scenarios":[...],"passed":true,"ms":1234}
{"t":"suite_end","featuresPassed":10,"featuresFailed":2,"scenariosPassed":42,"scenariosFailed":3,"ms":12345}
At suite end, this listener generates HTML reports from the accumulated JSON Lines data.
-
Constructor Summary
ConstructorsConstructorDescriptionJsonLinesReportListener(Path outputDir, String env) Create a new JSON Lines report listener. -
Method Summary
Modifier and TypeMethodDescriptionGet the path to the JSON Lines file.voidonFeatureEnd(FeatureResult result) Called when a feature completes execution.voidonSuiteEnd(SuiteResult result) Called when the suite completes execution.voidonSuiteStart(Suite suite) Called when the suite starts execution.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.karatelabs.output.ResultListener
onFeatureStart, onScenarioEnd, onScenarioStart
-
Constructor Details
-
JsonLinesReportListener
Create a new JSON Lines report listener.- Parameters:
outputDir- the directory to write reportsenv- the karate environment (may be null)
-
-
Method Details
-
onSuiteStart
Description copied from interface:ResultListenerCalled when the suite starts execution.- Specified by:
onSuiteStartin interfaceResultListener- Parameters:
suite- the suite about to run
-
onFeatureEnd
Description copied from interface:ResultListenerCalled when a feature completes execution.- Specified by:
onFeatureEndin interfaceResultListener- Parameters:
result- the feature result
-
onSuiteEnd
Description copied from interface:ResultListenerCalled when the suite completes execution.- Specified by:
onSuiteEndin interfaceResultListener- Parameters:
result- the final suite result
-
getJsonlPath
Get the path to the JSON Lines file.
-