Skip to content

Commit ec3a351

Browse files
authored
Merge pull request #1225 from mikepenz/feature/grouped_summary
Configuration to enable grouping by TestSuite in the Detail Summary
2 parents 5eb8e3e + b317015 commit ec3a351

File tree

12 files changed

+283
-132
lines changed

12 files changed

+283
-132
lines changed

.github/workflows/build.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,19 @@ jobs:
8888
[{"searchValue":"::","replaceValue":"/"}]
8989
annotate_only: ${{ github.event_name == 'workflow_dispatch' }}
9090

91+
- name: Test Nested JUnit test import
92+
uses: ./
93+
with:
94+
check_name: Example Nested JUnit Test Report
95+
report_paths: 'test_results/nested/multi-level.xml'
96+
include_passed: true
97+
detailed_summary: true
98+
group_suite: true
99+
comment: true
100+
skip_annotations: true
101+
check_title_template: '{{TEST_NAME}}'
102+
annotate_only: ${{ github.event_name == 'workflow_dispatch' }}
103+
91104
release:
92105
if: startsWith(github.ref, 'refs/tags/')
93106
runs-on: ubuntu-latest

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,14 @@ jobs:
9696
| `job_summary` | Optional. Enables the publishing of the job summary for the results. Defaults to `true`. May be required to disable [Enterprise Server](https://github.com/mikepenz/action-junit-report/issues/637) |
9797
| `detailed_summary` | Optional. Include table with all test results in the summary. Defaults to `false`. |
9898
| `flaky_summary` | Optional. Include table with all falky results in the summary. Defaults to `false`. |
99+
| `group_suite` | Optional. If enabled, will group the testcases by test suite in the `detailed_summary`. Defaults to `false`. |
99100
| `comment` | Optional. Enables a comment being added to the PR with the summary tables (Respects the summary configuration flags). Defaults to `false`. |
100101
| `updateComment` | Optional. If a prior action run comment exists, it is updated. If disabled, new comments are creted for each run. Defaults to `true`. |
101102
| `annotate_notice` | Optional. Annotate passed test results along with warning/failed ones. Defaults to `false`. (Changed in v3.5.0) |
102103
| `follow_symlink` | Optional. Enables to follow symlinks when searching test files via the globber. Defaults to `false`. |
103104
| `job_name` | Optional. Specify the name of a check to update |
104105
| `annotations_limit` | Optional. Specify the limit for annotations. This will also interrupt parsing all test-suites if the limit is reached. Defaults to: `No Limit`. |
106+
| `skip_annotations` | Optional. Setting this flag will result in no annotations being added to the run. Defaults to `false`. |
105107

106108
### Common Configurations
107109

__tests__/table.test.ts

Lines changed: 109 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,50 @@ import {buildSummaryTables} from '../src/table'
66
*/
77
jest.setTimeout(30000)
88

9+
const NORMAL_TABLE = [
10+
[
11+
{
12+
'data': '',
13+
'header': true
14+
},
15+
{
16+
'data': 'Tests',
17+
'header': true
18+
},
19+
{
20+
'data': 'Passed ✅',
21+
'header': true
22+
},
23+
{
24+
'data': 'Skipped ⏭️',
25+
'header': true
26+
},
27+
{
28+
'data': 'Failed ❌',
29+
'header': true
30+
}
31+
],
32+
[
33+
'checkName',
34+
'3 ran',
35+
'3 passed',
36+
'0 skipped',
37+
'0 failed'
38+
]
39+
]
40+
const FLAKY_TABLE = [
41+
[
42+
{
43+
'data': 'Test',
44+
'header': true
45+
},
46+
{
47+
'data': 'Retries',
48+
'header': true
49+
}
50+
]
51+
]
52+
953
describe('buildSummaryTables', () => {
1054
it('should build simple tables', async () => {
1155
const testResult = await parseTestReports(
@@ -22,83 +66,98 @@ describe('buildSummaryTables', () => {
2266

2367
const [table, detailTable, flakyTable] = buildSummaryTables([testResult], true, true, true)
2468

25-
expect(table).toStrictEqual([
69+
expect(table).toStrictEqual(NORMAL_TABLE)
70+
expect(detailTable).toStrictEqual([
2671
[
2772
{
28-
'data': '',
29-
'header': true
30-
},
31-
{
32-
'data': 'Tests',
33-
'header': true
34-
},
35-
{
36-
'data': 'Passed ✅',
37-
'header': true
73+
"data": "Test",
74+
"header": true
3875
},
3976
{
40-
'data': 'Skipped ⏭️',
41-
'header': true
42-
},
77+
"data": "Result",
78+
"header": true
79+
}
80+
],
81+
[
4382
{
44-
'data': 'Failed ❌',
45-
'header': true
83+
"data": "<strong>checkName</strong>",
84+
"colspan": "2"
4685
}
4786
],
4887
[
49-
'checkName',
50-
'3 ran',
51-
'3 passed',
52-
'0 skipped',
53-
'0 failed'
88+
"ABC-0199: XMPP Ping/PingIntegrationTest.pingAsync (Normal)",
89+
"✅ pass"
90+
],
91+
[
92+
"ABC-0199: XMPP Ping/PingIntegrationTest.pingServer (Normal)",
93+
"✅ pass"
94+
],
95+
[
96+
"ABC-0045: Multi-User Chat/MultiUserIntegrationTest.mucRoleTestForReceivingModerator (Normal)",
97+
"✅ pass"
5498
]
5599
])
100+
expect(flakyTable).toStrictEqual(FLAKY_TABLE)
101+
})
102+
103+
it('should group detail tables', async () => {
104+
const testResult = await parseTestReports(
105+
'checkName',
106+
'summary',
107+
'test_results/nested/multi-level.xml',
108+
'*',
109+
true,
110+
true,
111+
[],
112+
'{{SUITE_NAME}}/{{TEST_NAME}}',
113+
'/'
114+
)
115+
116+
const [table, detailTable, flakyTable] = buildSummaryTables([testResult], true, true, true, true)
117+
118+
expect(table).toStrictEqual(NORMAL_TABLE)
56119
expect(detailTable).toStrictEqual([
57120
[
58121
{
59-
'data': '',
60-
'header': true
122+
"data": "Test",
123+
"header": true
61124
},
62125
{
63-
'data': 'Test',
64-
'header': true
65-
},
126+
"data": "Result",
127+
"header": true
128+
}
129+
],
130+
[
66131
{
67-
'data': 'Result',
68-
'header': true
132+
"data": "<strong>checkName</strong>",
133+
"colspan": "2"
69134
}
70135
],
71136
[
72-
'checkName',
73-
'XEP-0199: XMPP Ping/PingIntegrationTest.pingAsync (Normal)',
74-
'✅ pass'
137+
{
138+
"data": "<em>ABC-0199: XMPP Ping</em>",
139+
"colspan": "2"
140+
}
75141
],
76142
[
77-
'checkName',
78-
'XEP-0199: XMPP Ping/PingIntegrationTest.pingServer (Normal)',
79-
'✅ pass'
143+
"ABC-0199: XMPP Ping/PingIntegrationTest.pingAsync (Normal)",
144+
"✅ pass"
80145
],
81146
[
82-
'checkName',
83-
'XEP-0045: Multi-User Chat/MultiUserChatRolesAffiliationsPrivilegesIntegrationTest.mucRoleTestForReceivingModerator (Normal)',
84-
'✅ pass'
85-
]
86-
])
87-
expect(flakyTable).toStrictEqual([
147+
"ABC-0199: XMPP Ping/PingIntegrationTest.pingServer (Normal)",
148+
"✅ pass"
149+
],
88150
[
89151
{
90-
'data': '',
91-
'header': true
92-
},
93-
{
94-
'data': 'Test',
95-
'header': true
96-
},
97-
{
98-
'data': 'Retries',
99-
'header': true
152+
"data": "<em>ABC-0045: Multi-User Chat</em>",
153+
"colspan": "2"
100154
}
155+
],
156+
[
157+
"ABC-0045: Multi-User Chat/MultiUserIntegrationTest.mucRoleTestForReceivingModerator (Normal)",
158+
"✅ pass"
101159
]
102160
])
161+
expect(flakyTable).toStrictEqual(FLAKY_TABLE)
103162
})
104163
})

__tests__/testParser.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Annotation, parseFile, parseTestReports, resolveFileAndLine, resolvePath, Transformer} from '../src/testParser'
1+
import {parseFile, parseTestReports, resolveFileAndLine, resolvePath, Transformer} from '../src/testParser'
22

33
/**
44
* Original test cases:
@@ -1308,7 +1308,7 @@ describe('parseTestReports', () => {
13081308
foundFiles: 1,
13091309
globalAnnotations: [],
13101310
passed: 0,
1311-
annotations: []
1311+
testResults: []
13121312
})
13131313
})
13141314
})

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ inputs:
9494
description: 'Include table with all flaky results in summary'
9595
required: false
9696
default: 'false'
97+
group_suite:
98+
description: 'If enabled, will group the testcases by test suite in the `detailed_summary`'
99+
required: false
100+
default: 'false'
97101
comment:
98102
description: 'Enables a comment being added to the PR with the summary tables (summary has to be enabled). Default: false'
99103
required: false

0 commit comments

Comments
 (0)