Class JsonTestFormatter
java.lang.Object
org.ek9lang.cli.JsonTestFormatter
- All Implemented Interfaces:
TestResultFormatter
JSON test output formatter (-t2).
Structured output optimized for AI/LLM integration and programmatic consumption.
Output includes comprehensive test type information:
{
"summary": {
"total": 4,
"passed": 3,
"failed": 1,
"types": {
"assert": 1,
"blackbox": 1,
"parameterized": 2
}
},
"tests": [
{
"name": "SimpleTest",
"fqn": "test.module::SimpleTest",
"source_file": "/path/to/test.ek9",
"test_type": "assert",
"case_id": null,
...
},
{
"name": "ParamTest",
"fqn": "test.module::ParamTest",
"source_file": "/path/to/test.ek9",
"test_type": "parameterized",
"case_id": "hello",
...
}
]
}
All output is valid JSON that can be piped to jq or parsed by any JSON library.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidreportDiscovery(List<DiscoveredTest> tests, PrintStream out) Report the discovery of tests before execution begins.voidreportExecutionStart(int testCount, PrintStream out) Report that test execution is starting.voidreportResults(List<TestResult> results, PrintStream out) Report all test results after execution completes.
-
Constructor Details
-
JsonTestFormatter
JsonTestFormatter()
-
-
Method Details
-
reportDiscovery
Description copied from interface:TestResultFormatterReport 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:
reportDiscoveryin interfaceTestResultFormatter- Parameters:
tests- The discovered tests with metadataout- The output stream
-
reportExecutionStart
Description copied from interface:TestResultFormatterReport that test execution is starting. Some formatters may output a progress message here.- Specified by:
reportExecutionStartin interfaceTestResultFormatter- Parameters:
testCount- The number of tests to executeout- The output stream
-
reportResults
Description copied from interface:TestResultFormatterReport all test results after execution completes.- Specified by:
reportResultsin interfaceTestResultFormatter- Parameters:
results- The test resultsout- The output stream
-