Skip to content

Commit d1e3942

Browse files
Feat/junit to ctrf (#129)
* feat: junit to ctrf integration
1 parent 15f5015 commit d1e3942

File tree

12 files changed

+78590
-66319
lines changed

12 files changed

+78590
-66319
lines changed

.github/workflows/build-and-test.yaml

+35-3
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ jobs:
215215
- name: Reports Requiring Previous
216216
uses: ./
217217
with:
218-
report-path: './ctrf-reports/ctrf-report.json'
218+
report-path: './ctrf-reports/*.json'
219219
previous-results-report: true
220220
flaky-rate-report: true
221221
fail-rate-report: true
@@ -225,6 +225,39 @@ jobs:
225225
env:
226226
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
227227
if: always()
228+
junit-to-ctrf-test:
229+
needs: build-and-test
230+
runs-on: ubuntu-latest
231+
steps:
232+
- name: Checkout code
233+
uses: actions/checkout@v4
234+
- name: Install dependencies
235+
run: npm install
236+
- name: Modify reports
237+
run: npm run modify-reports
238+
- name: JUnit to CTRF integration test
239+
uses: ./
240+
with:
241+
report-path: './ctrf-reports/*.xml'
242+
integrations-config: |
243+
{
244+
"junit-to-ctrf": {
245+
"enabled": true,
246+
"action": "convert",
247+
"options": {
248+
"output": "./ctrf-reports/ctrf-report.json",
249+
"toolname": "junit-to-ctrf",
250+
"useSuiteName": false,
251+
"env": {
252+
"appName": "my-app"
253+
}
254+
}
255+
}
256+
}
257+
annotate: false
258+
env:
259+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
260+
if: always()
228261
npx-cli-test:
229262
runs-on: ubuntu-latest
230263
needs: build-and-test
@@ -238,5 +271,4 @@ jobs:
238271
- name: Modify reports
239272
run: npm run modify-reports
240273
- name: Default tables
241-
run: node dist/core/cli.js ctrf-reports/ctrf-report.json --title "Default tables" --annotate false
242-
274+
run: node dist/core/cli.js ctrf-reports/ctrf-report.json --title "Default tables" --annotate false

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ most testing frameworks and easy to install.
106106

107107
**No CTRF reporter? No problem!**
108108

109-
Use [junit-to-ctrf](https://github.com/ctrf-io/junit-to-ctrf) to convert a JUnit
110-
report to CTRF
109+
Use the [JUnit to CTRF integration](docs/integrations.md#junit-to-ctrf-integration) or [junit-to-ctrf](https://github.com/ctrf-io/junit-to-ctrf) cli to convert a JUnit
110+
report to CTRF.
111111

112112
## Available Inputs
113113

badges/coverage.svg

+1-1
Loading

ctrf-reports/test-junit.xml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<testsuites>
3+
<testsuite name="com.example.UnitTests" tests="6" failures="1" errors="1" skipped="1" time="0.350">
4+
<testcase name="testAddition" classname="com.example.UnitTests" time="0.015"/>
5+
<testcase name="testSubtraction" classname="com.example.UnitTests" time="0.010"/>
6+
<testcase name="testMultiplication" classname="com.example.UnitTests" time="0.020">
7+
<failure message="Expected 10 but was 9" type="AssertionError">
8+
Stack trace details...
9+
</failure>
10+
</testcase>
11+
<testcase name="testDivision" classname="com.example.UnitTests" time="0.000">
12+
<skipped/>
13+
</testcase>
14+
<testcase name="testModulo" classname="com.example.UnitTests" time="0.005">
15+
<error message="NullPointerException occurred" type="java.lang.NullPointerException">
16+
Stack trace details...
17+
</error>
18+
</testcase>
19+
<testcase name="testSquareRoot" classname="com.example.UnitTests" time="0.300"/>
20+
<system-out><![CDATA[Standard output logs for UnitTests]]></system-out>
21+
<system-err><![CDATA[Standard error logs for UnitTests]]></system-err>
22+
</testsuite>
23+
<testsuite name="com.example.IntegrationTests" tests="4" failures="0" errors="0" skipped="0" time="1.200">
24+
<testcase name="testUserLogin" classname="com.example.IntegrationTests" time="0.400"/>
25+
<testcase name="testUserRegistration" classname="com.example.IntegrationTests" time="0.300"/>
26+
<testcase name="testProductSearch" classname="com.example.IntegrationTests" time="0.200"/>
27+
<testcase name="testCheckoutProcess" classname="com.example.IntegrationTests" time="0.300"/>
28+
<system-out><![CDATA[Integration test logs...]]></system-out>
29+
<system-err><![CDATA[Integration test error logs...]]></system-err>
30+
</testsuite>
31+
</testsuites>
32+

0 commit comments

Comments
 (0)