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:
Piotr Mionskowski 2025-12-05 09:43:46 +01:00
parent ee446707ff
commit eedd088b6d
11 changed files with 1255 additions and 0 deletions

View file

@ -0,0 +1,24 @@
![Tests failed](https://img.shields.io/badge/tests-4%20passed%2C%201%20failed%2C%201%20skipped-critical)
|Report|Passed|Failed|Skipped|Time|
|:---|---:|---:|---:|---:|
|[fixtures/open-test-reporting/events.xml](#user-content-r0)|4 ✅|1 ❌|1 ⚪|1s|
## ❌ <a id="user-content-r0" href="#user-content-r0">fixtures/open-test-reporting/events.xml</a>
**6** tests were completed in **1s** with **4** passed, **1** failed and **1** skipped.
|Test suite|Passed|Failed|Skipped|Time|
|:---|---:|---:|---:|---:|
|[com.example.CalculatorTest](#user-content-r0s0)|2 ✅|1 ❌|1 ⚪|700ms|
|[com.example.StringUtilsTest](#user-content-r0s1)|2 ✅|||400ms|
### ❌ <a id="user-content-r0s0" href="#user-content-r0s0">com.example.CalculatorTest</a>
```
✅ testAddition
✅ testSubtraction
❌ testDivision
java.lang.ArithmeticException: Division by zero
⚪ testMultiplication
```
### ✅ <a id="user-content-r0s1" href="#user-content-r0s1">com.example.StringUtilsTest</a>
```
TrimTests
✅ testTrimLeft
✅ testTrimRight
```

View file

@ -0,0 +1,27 @@
![Tests failed](https://img.shields.io/badge/tests-5%20passed%2C%201%20failed%2C%201%20skipped-critical)
|Report|Passed|Failed|Skipped|Time|
|:---|---:|---:|---:|---:|
|[fixtures/open-test-reporting/hierarchy.xml](#user-content-r0)|5 ✅|1 ❌|1 ⚪|4s|
## ❌ <a id="user-content-r0" href="#user-content-r0">fixtures/open-test-reporting/hierarchy.xml</a>
**7** tests were completed in **4s** with **5** passed, **1** failed and **1** skipped.
|Test suite|Passed|Failed|Skipped|Time|
|:---|---:|---:|---:|---:|
|[com.example.EmptySuite](#user-content-r0s0)||||0ms|
|[com.example.PaymentServiceTest](#user-content-r0s1)|3 ✅|1 ❌||3s|
|[com.example.UserServiceTest](#user-content-r0s2)|2 ✅||1 ⚪|1s|
### ❌ <a id="user-content-r0s1" href="#user-content-r0s1">com.example.PaymentServiceTest</a>
```
ValidationTests
✅ testValidAmount
✅ testInvalidAmount
ProcessingTests
✅ testSuccessfulPayment
❌ testPaymentTimeout
org.opentest4j.AssertionFailedError: Payment should complete within 500ms but took 700ms
```
### ✅ <a id="user-content-r0s2" href="#user-content-r0s2">com.example.UserServiceTest</a>
```
✅ testUserCreation
✅ testUserDeletion
⚪ testUserUpdate
```