Skip to content

Commit bdfeffa

Browse files
committed
Add error annotations for test failures and errors
1 parent a520fab commit bdfeffa

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

integration-test/reports/TEST-de.donnerbart.example.DeletedTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<testsuite name="de.donnerbart.example.DeletedTest" tests="1" skipped="0" failures="0" errors="0"
2+
<testsuite name="de.donnerbart.example.DeletedTest" tests="1" skipped="0" failures="1" errors="0"
33
timestamp="2025-01-01T00:00:00" hostname="example" time="2.374">
44
<properties/>
55
<testcase name="testDeletedMethod()"

integration-test/reports/TEST-de.donnerbart.example.SlowestTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<testsuite name="de.donnerbart.example.SlowestTest" tests="1" skipped="0" failures="0" errors="0"
2+
<testsuite name="de.donnerbart.example.SlowestTest" tests="1" skipped="0" failures="0" errors="1"
33
timestamp="2025-01-01T00:00:00" hostname="example" time="153.457">
44
<properties/>
55
<testcase name="testFastMethod()"

merge-junit-reports/action.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,18 @@ runs:
9999
shell: bash
100100
run: cp junit-reports-artifact/*.xml junit-reports/
101101

102+
- name: Report failed tests
103+
shell: bash
104+
working-directory: junit-reports
105+
run: |
106+
find . -name "*.xml" | while read -r REPORT; do
107+
FILE="$(basename "$REPORT")"
108+
xmlstarlet sel -t \
109+
-m "//testsuite[@failures > 0 or @errors > 0]" \
110+
-v "concat('::error file=', '$FILE', ',line=1,title=', @name, '::Test failed: ', @failures, ' failure(s), ', @errors, ' error(s)')" -n \
111+
"$REPORT" || true
112+
done
113+
102114
- name: Update JUnit reports
103115
uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9
104116
with:

0 commit comments

Comments
 (0)