Reporters are the output layer of KT Testing Suite Core. The runner knows nothing about how results should be presented—it simply calls well-defined lifecycle methods on whatever object you pass as the reporter. The library ships two built-in implementations:Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Octopodo/kt-testing-suite-core/llms.txt
Use this file to discover all available pages before exploring further.
ConsoleReporter, which prints human-readable lines via $.writeln, and JSONReporter, which additionally builds a structured result tree and emits JSON either to a file or as delimited output on $.writeln. You can also implement the TestReporter interface yourself to produce any output format you need.
Type Definitions
TestResult
onTestEnd.
The test name as passed to
it().The result of the test run. The runner currently sets
'passed' or 'failed'; 'skipped' is available for custom reporters or future use.Present only when
status is 'failed'. Contains the details of the thrown error.Elapsed time in milliseconds for this test. Not currently populated by the built-in runner but included in the interface for custom implementations.
SuiteResult
JSONReporter builds a tree of these objects as the run progresses.
The suite label as passed to
describe().The results of all tests registered directly on this suite.
Results for any nested
describe blocks inside this suite.TestReporter interface
Called once before any suite is processed. Use this to initialise state, print a header, or open output streams.
Called each time the runner begins processing a suite (including nested suites).
suite is the raw Suite object, not a SuiteResult.Called immediately before a test function is invoked.
test is the raw Test object containing name and fn.Called after a test finishes, whether it passed or failed.
result carries the outcome and any error details.Called after all tests and child suites in a suite have been processed (inside the
finally block, so it always runs).Called once after all root suites have been processed.
results contains aggregate passed, failed, and total counts.ConsoleReporter
$.writeln. All six TestReporter methods are implemented; onStart and onSuiteEnd are no-ops.
Output Format
Method Implementations
| Method | Behaviour |
|---|---|
onStart() | No-op |
onSuiteStart(suite) | $.writeln('Suite: ' + suite.description) |
onTestStart(test) | $.writeln(' Test: ' + test.name) |
onTestEnd(test, result) | Prints ✅ Passed, ❌ Failed: …, or ⚠️ Skipped |
onSuiteEnd(suite) | No-op |
onFinished(results) | Prints the summary block with passed/failed counts |
Example
JSONReporter
ConsoleReporter internally and delegates all console-output calls to it, while additionally building a structured SuiteResult tree during the run and emitting a JSON document when onFinished is called.
constructor()
An absolute file path where the JSON report should be written. If omitted, the JSON is written to
$.writeln wrapped in delimiter lines (see JSON Output Format below). If provided, the runner will attempt to open the file for writing via the ExtendScript File API.Internal State
JSONReporter maintains two private data structures alongside a ConsoleReporter delegate:
The list of top-level
SuiteResult objects. Populated during onSuiteStart / onSuiteEnd as the runner traverses the tree.A stack that tracks the currently active suite during traversal.
onSuiteStart pushes a new SuiteResult; onSuiteEnd pops it. Nested suites are automatically linked to their parent via parent.suites.push(child).Delegation to ConsoleReporter
JSONReporter delegates every console-output operation to an internal ConsoleReporter instance. This means running with JSONReporter produces the same human-readable output as ConsoleReporter plus the JSON document at the end.
| JSONReporter method | Console delegation |
|---|---|
onStart() | Resets rootSuites and suiteStack, then calls consoleReporter.onStart() |
onSuiteStart(suite) | Builds SuiteResult, links to parent or rootSuites, calls consoleReporter.onSuiteStart() |
onTestStart(test) | Calls consoleReporter.onTestStart() |
onTestEnd(test, result) | Pushes result onto current suite’s tests, calls consoleReporter.onTestEnd() |
onSuiteEnd(suite) | Pops suiteStack, calls consoleReporter.onSuiteEnd() |
onFinished(results) | Calls consoleReporter.onFinished(), then emits JSON |
JSON Output Format
The emitted JSON has the following shape:outputPath is not set, the JSON is written to $.writeln between two delimiter lines that allow an external script or host process to extract it reliably:
outputPath is set, the JSON is written directly to the file using the ExtendScript File API. If the write fails, an error is logged to $.writeln:
Example
Sample JSON output
Implementing a Custom Reporter
ImplementTestReporter to produce any output you need—XML, a CEP panel message, a BridgeTalk packet, or anything else.