test-reporter/__tests__/fixtures/open-test-reporting/hierarchy.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

60 lines
2.7 KiB
XML

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<h:execution xmlns:h="https://schemas.opentest4j.org/reporting/hierarchy/0.2.0"
xmlns="https://schemas.opentest4j.org/reporting/core/0.2.0">
<infrastructure>
<hostName>build-agent-01</hostName>
<userName>ci</userName>
<operatingSystem>Linux</operatingSystem>
<cpuCores>4</cpuCores>
</infrastructure>
<!-- Suite: UserServiceTest -->
<h:root duration="PT1.234S" name="com.example.UserServiceTest" start="2024-01-15T10:30:00.000Z">
<result status="SUCCESSFUL"/>
<h:child duration="PT0.123S" name="testUserCreation" start="2024-01-15T10:30:00.100Z">
<result status="SUCCESSFUL"/>
</h:child>
<h:child duration="PT0.234S" name="testUserDeletion" start="2024-01-15T10:30:00.300Z">
<result status="SUCCESSFUL"/>
</h:child>
<h:child duration="PT0.045S" name="testUserUpdate" start="2024-01-15T10:30:00.600Z">
<result status="SKIPPED">
<reason>Skipped: Database not available</reason>
</result>
</h:child>
</h:root>
<!-- Suite: PaymentServiceTest with nested groups -->
<h:root duration="PT2.5S" name="com.example.PaymentServiceTest" start="2024-01-15T10:30:02.000Z">
<result status="FAILED"/>
<!-- Group: ValidationTests -->
<h:child duration="PT0.8S" name="ValidationTests" start="2024-01-15T10:30:02.100Z">
<result status="SUCCESSFUL"/>
<h:child duration="PT0.2S" name="testValidAmount" start="2024-01-15T10:30:02.110Z">
<result status="SUCCESSFUL"/>
</h:child>
<h:child duration="PT0.3S" name="testInvalidAmount" start="2024-01-15T10:30:02.320Z">
<result status="SUCCESSFUL"/>
</h:child>
</h:child>
<!-- Group: ProcessingTests -->
<h:child duration="PT1.2S" name="ProcessingTests" start="2024-01-15T10:30:03.000Z">
<result status="FAILED"/>
<h:child duration="PT0.5S" name="testSuccessfulPayment" start="2024-01-15T10:30:03.100Z">
<result status="SUCCESSFUL"/>
</h:child>
<h:child duration="PT0.7S" name="testPaymentTimeout" start="2024-01-15T10:30:03.700Z">
<result status="FAILED">
<reason>org.opentest4j.AssertionFailedError: Payment should complete within 500ms but took 700ms</reason>
</result>
</h:child>
</h:child>
</h:root>
<!-- Suite: EmptySuite (edge case) -->
<h:root duration="PT0S" name="com.example.EmptySuite" start="2024-01-15T10:30:05.000Z">
<result status="SUCCESSFUL"/>
</h:root>
</h:execution>