Skip to content

Commit 21a21f4

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

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-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: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,17 @@ 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+
xmlstarlet sel -t \
108+
-m "//testsuite[@failures > 0 or @errors > 0]" \
109+
-v "concat('::error file=', '$file', ',line=1,title=', @name, '::Test suite failed: ', @failures, ' failure(s), ', @errors, ' error(s)')" -n \
110+
"$REPORT"
111+
done
112+
102113
- name: Update JUnit reports
103114
uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9
104115
with:

0 commit comments

Comments
 (0)