The window.GoTestReport constructor is the main entry point for the reporting logic. It initializes event listeners on provided DOM elements to enable interactive test reporting.
To use it, you must provide a GoTestReportElements object containing the necessary DOM nodes and the test data.
Required Data Structures:
GoTestReportElements:
data: A TestResults array containing the test hierarchy.testResultsElem: The HTMLElement that acts as the container for test result groups (receives click events).testGroupListElem: The HTMLElement where individual test rows are rendered.
TestResults (Data Schema):
An array of TestGroupData objects. Each group contains:
FailureIndicator: stringSkippedIndicator: stringTestResults: An array of TestStatus objects.
TestStatus (Individual Test Schema):
TestName: stringPackage: stringElapsedTime: numberOutput: Array of stringsPassed: booleanSkipped: booleanTestFileName: stringTestFunctionDetail: object containing Line and Col
// Example initialization
const elements = {
data: testDataJson, // The parsed JSON test results
testResultsElem: document.getElementById('test-results-container'),
testGroupListElem: document.getElementById('test-group-list')
};
const reportController = window.GoTestReport(elements);