Skip to content

Commit dda3b1e

Browse files
committed
- introduce ability to group the test detailed summary
- expand test for grouped summary
1 parent 5eb8e3e commit dda3b1e

File tree

9 files changed

+250
-107
lines changed

9 files changed

+250
-107
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,16 @@ 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+
check_title_template: '{{SUITE_NAME}} | {{TEST_NAME}}'
99+
annotate_only: ${{ github.event_name == 'workflow_dispatch' }}
100+
91101
release:
92102
if: startsWith(github.ref, 'refs/tags/')
93103
runs-on: ubuntu-latest

__tests__/table.test.ts

Lines changed: 109 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,54 @@ 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': '',
44+
'header': true
45+
},
46+
{
47+
'data': 'Test',
48+
'header': true
49+
},
50+
{
51+
'data': 'Retries',
52+
'header': true
53+
}
54+
]
55+
]
56+
957
describe('buildSummaryTables', () => {
1058
it('should build simple tables', async () => {
1159
const testResult = await parseTestReports(
@@ -22,83 +70,94 @@ describe('buildSummaryTables', () => {
2270

2371
const [table, detailTable, flakyTable] = buildSummaryTables([testResult], true, true, true)
2472

25-
expect(table).toStrictEqual([
73+
expect(table).toStrictEqual(NORMAL_TABLE)
74+
expect(detailTable).toStrictEqual([
2675
[
2776
{
28-
'data': '',
29-
'header': true
77+
"data": "",
78+
"header": true
3079
},
3180
{
32-
'data': 'Tests',
33-
'header': true
81+
"data": "Test",
82+
"header": true
3483
},
3584
{
36-
'data': 'Passed ✅',
37-
'header': true
38-
},
39-
{
40-
'data': 'Skipped ⏭️',
41-
'header': true
42-
},
43-
{
44-
'data': 'Failed ❌',
45-
'header': true
85+
"data": "Result",
86+
"header": true
4687
}
4788
],
4889
[
49-
'checkName',
50-
'3 ran',
51-
'3 passed',
52-
'0 skipped',
53-
'0 failed'
90+
"checkName",
91+
"ABC-0199: XMPP Ping/PingIntegrationTest.pingAsync (Normal)",
92+
"✅ pass"
93+
],
94+
[
95+
"checkName",
96+
"ABC-0199: XMPP Ping/PingIntegrationTest.pingServer (Normal)",
97+
"✅ pass"
98+
],
99+
[
100+
"checkName",
101+
"ABC-0045: Multi-User Chat/MultiUserIntegrationTest.mucRoleTestForReceivingModerator (Normal)",
102+
"✅ pass"
54103
]
55104
])
105+
expect(flakyTable).toStrictEqual(FLAKY_TABLE)
106+
})
107+
108+
it('should group detail tables', async () => {
109+
const testResult = await parseTestReports(
110+
'checkName',
111+
'summary',
112+
'test_results/nested/multi-level.xml',
113+
'*',
114+
true,
115+
true,
116+
[],
117+
'{{SUITE_NAME}}/{{TEST_NAME}}',
118+
'/'
119+
)
120+
121+
const [table, detailTable, flakyTable] = buildSummaryTables([testResult], true, true, true, true)
122+
123+
expect(table).toStrictEqual(NORMAL_TABLE)
56124
expect(detailTable).toStrictEqual([
57125
[
58126
{
59-
'data': '',
60-
'header': true
127+
"data": "",
128+
"header": true
61129
},
62130
{
63-
'data': 'Test',
64-
'header': true
131+
"data": "Test",
132+
"header": true
65133
},
66134
{
67-
'data': 'Result',
68-
'header': true
135+
"data": "Result",
136+
"header": true
69137
}
70138
],
71139
[
72-
'checkName',
73-
'XEP-0199: XMPP Ping/PingIntegrationTest.pingAsync (Normal)',
74-
'✅ pass'
140+
"ABC-0199: XMPP Ping"
75141
],
76142
[
77-
'checkName',
78-
'XEP-0199: XMPP Ping/PingIntegrationTest.pingServer (Normal)',
79-
'✅ pass'
143+
"",
144+
"ABC-0199: XMPP Ping/PingIntegrationTest.pingAsync (Normal)",
145+
"✅ pass"
80146
],
81147
[
82-
'checkName',
83-
'XEP-0045: Multi-User Chat/MultiUserChatRolesAffiliationsPrivilegesIntegrationTest.mucRoleTestForReceivingModerator (Normal)',
84-
'✅ pass'
85-
]
86-
])
87-
expect(flakyTable).toStrictEqual([
148+
"",
149+
"ABC-0199: XMPP Ping/PingIntegrationTest.pingServer (Normal)",
150+
"✅ pass"
151+
],
88152
[
89-
{
90-
'data': '',
91-
'header': true
92-
},
93-
{
94-
'data': 'Test',
95-
'header': true
96-
},
97-
{
98-
'data': 'Retries',
99-
'header': true
100-
}
153+
"ABC-0045: Multi-User Chat"
154+
],
155+
[
156+
"",
157+
"ABC-0045: Multi-User Chat/MultiUserIntegrationTest.mucRoleTestForReceivingModerator (Normal)",
158+
"✅ pass"
101159
]
102160
])
161+
expect(flakyTable).toStrictEqual(FLAKY_TABLE)
103162
})
104163
})

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

dist/index.js

Lines changed: 50 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export async function run(): Promise<void> {
3030
const jobSummary = core.getInput('job_summary') === 'true'
3131
const detailedSummary = core.getInput('detailed_summary') === 'true'
3232
const flakySummary = core.getInput('flaky_summary') === 'true'
33+
const groupSuite = core.getInput('group_suite') === 'true'
3334
const comment = core.getInput('comment') === 'true'
3435
const updateComment = core.getInput('updateComment') === 'true'
3536
const jobName = core.getInput('job_name')
@@ -66,8 +67,8 @@ export async function run(): Promise<void> {
6667
failed: 0,
6768
passed: 0,
6869
foundFiles: 0,
69-
annotations: [],
70-
globalAnnotations: []
70+
globalAnnotations: [],
71+
testResults: []
7172
}
7273

7374
core.info(`Preparing ${reportsCount} report as configured.`)
@@ -146,7 +147,8 @@ export async function run(): Promise<void> {
146147
testResults,
147148
includePassed,
148149
detailedSummary,
149-
flakySummary
150+
flakySummary,
151+
groupSuite
150152
)
151153
if (jobSummary && supportsJobSummary) {
152154
try {

0 commit comments

Comments
 (0)