mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-16 14:27:10 +01:00
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
This commit is contained in:
parent
ee446707ff
commit
eedd088b6d
11 changed files with 1255 additions and 0 deletions
60
__tests__/fixtures/open-test-reporting/hierarchy.xml
Normal file
60
__tests__/fixtures/open-test-reporting/hierarchy.xml
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<?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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue