test-reporter/__tests__/fixtures/open-test-reporting/events.xml
Piotr Mionskowski eedd088b6d Add support for open-test-reporting format
Add a new parser for the open-test-reporting format developed by the
JUnit team (https://github.com/ota4j-team/open-test-reporting).

This format is a modern, framework-agnostic XML-based test reporting
standard that supports rich metadata including tags, attachments, and
infrastructure information.

Features:
- Auto-detection of both XML format variants:
  - Hierarchical format (h:execution) - tree-structured results
  - Event-based format (e:events) - streaming/real-time results
- ISO 8601 duration parsing (e.g., PT1.234S)
- Status mapping: SUCCESSFUL, SKIPPED, ABORTED, FAILED, ERRORED
- Error message extraction from failed tests
- Proper XML namespace handling

Files added:
- src/parsers/open-test-reporting/open-test-reporting-types.ts
- src/parsers/open-test-reporting/open-test-reporting-parser.ts
- __tests__/open-test-reporting.test.ts (20 tests)
- __tests__/fixtures/open-test-reporting/*.xml
2025-12-05 09:43:46 +01:00

71 lines
2.8 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<e:events xmlns="https://schemas.opentest4j.org/reporting/core/0.2.0"
xmlns:e="https://schemas.opentest4j.org/reporting/events/0.2.0">
<infrastructure>
<hostName>build-agent-02</hostName>
<userName>runner</userName>
<operatingSystem>macOS</operatingSystem>
<cpuCores>8</cpuCores>
</infrastructure>
<!-- Suite: CalculatorTest starts -->
<e:started id="suite-1" name="com.example.CalculatorTest" time="2024-01-15T11:00:00.000Z"/>
<!-- Test: testAddition -->
<e:started id="test-1" name="testAddition" parentId="suite-1" time="2024-01-15T11:00:00.100Z"/>
<e:finished id="test-1" time="2024-01-15T11:00:00.200Z">
<result status="SUCCESSFUL"/>
</e:finished>
<!-- Test: testSubtraction -->
<e:started id="test-2" name="testSubtraction" parentId="suite-1" time="2024-01-15T11:00:00.250Z"/>
<e:finished id="test-2" time="2024-01-15T11:00:00.400Z">
<result status="SUCCESSFUL"/>
</e:finished>
<!-- Test: testDivision (fails) -->
<e:started id="test-3" name="testDivision" parentId="suite-1" time="2024-01-15T11:00:00.450Z"/>
<e:finished id="test-3" time="2024-01-15T11:00:00.600Z">
<result status="FAILED">
<reason>java.lang.ArithmeticException: Division by zero</reason>
</result>
</e:finished>
<!-- Test: testMultiplication (skipped) -->
<e:started id="test-4" name="testMultiplication" parentId="suite-1" time="2024-01-15T11:00:00.650Z"/>
<e:finished id="test-4" time="2024-01-15T11:00:00.660Z">
<result status="SKIPPED">
<reason>Test disabled</reason>
</result>
</e:finished>
<!-- Suite: CalculatorTest finishes -->
<e:finished id="suite-1" time="2024-01-15T11:00:00.700Z">
<result status="FAILED"/>
</e:finished>
<!-- Suite: StringUtilsTest starts -->
<e:started id="suite-2" name="com.example.StringUtilsTest" time="2024-01-15T11:00:01.000Z"/>
<!-- Group: TrimTests -->
<e:started id="group-1" name="TrimTests" parentId="suite-2" time="2024-01-15T11:00:01.100Z"/>
<e:started id="test-5" name="testTrimLeft" parentId="group-1" time="2024-01-15T11:00:01.110Z"/>
<e:finished id="test-5" time="2024-01-15T11:00:01.200Z">
<result status="SUCCESSFUL"/>
</e:finished>
<e:started id="test-6" name="testTrimRight" parentId="group-1" time="2024-01-15T11:00:01.210Z"/>
<e:finished id="test-6" time="2024-01-15T11:00:01.300Z">
<result status="SUCCESSFUL"/>
</e:finished>
<e:finished id="group-1" time="2024-01-15T11:00:01.310Z">
<result status="SUCCESSFUL"/>
</e:finished>
<!-- Suite: StringUtilsTest finishes -->
<e:finished id="suite-2" time="2024-01-15T11:00:01.400Z">
<result status="SUCCESSFUL"/>
</e:finished>
</e:events>