Skip to content

Commit

Permalink
Merge pull request #1225 from mikepenz/feature/grouped_summary
Browse files Browse the repository at this point in the history
Configuration to enable grouping by TestSuite in the Detail Summary
  • Loading branch information
mikepenz authored Nov 3, 2024
2 parents 5eb8e3e + b317015 commit ec3a351
Show file tree
Hide file tree
Showing 12 changed files with 283 additions and 132 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,19 @@ jobs:
[{"searchValue":"::","replaceValue":"/"}]
annotate_only: ${{ github.event_name == 'workflow_dispatch' }}

- name: Test Nested JUnit test import
uses: ./
with:
check_name: Example Nested JUnit Test Report
report_paths: 'test_results/nested/multi-level.xml'
include_passed: true
detailed_summary: true
group_suite: true
comment: true
skip_annotations: true
check_title_template: '{{TEST_NAME}}'
annotate_only: ${{ github.event_name == 'workflow_dispatch' }}

release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,14 @@ jobs:
| `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) |
| `detailed_summary` | Optional. Include table with all test results in the summary. Defaults to `false`. |
| `flaky_summary` | Optional. Include table with all falky results in the summary. Defaults to `false`. |
| `group_suite` | Optional. If enabled, will group the testcases by test suite in the `detailed_summary`. Defaults to `false`. |
| `comment` | Optional. Enables a comment being added to the PR with the summary tables (Respects the summary configuration flags). Defaults to `false`. |
| `updateComment` | Optional. If a prior action run comment exists, it is updated. If disabled, new comments are creted for each run. Defaults to `true`. |
| `annotate_notice` | Optional. Annotate passed test results along with warning/failed ones. Defaults to `false`. (Changed in v3.5.0) |
| `follow_symlink` | Optional. Enables to follow symlinks when searching test files via the globber. Defaults to `false`. |
| `job_name` | Optional. Specify the name of a check to update |
| `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`. |
| `skip_annotations` | Optional. Setting this flag will result in no annotations being added to the run. Defaults to `false`. |

### Common Configurations

Expand Down
159 changes: 109 additions & 50 deletions __tests__/table.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,50 @@ import {buildSummaryTables} from '../src/table'
*/
jest.setTimeout(30000)

const NORMAL_TABLE = [
[
{
'data': '',
'header': true
},
{
'data': 'Tests',
'header': true
},
{
'data': 'Passed ✅',
'header': true
},
{
'data': 'Skipped ⏭️',
'header': true
},
{
'data': 'Failed ❌',
'header': true
}
],
[
'checkName',
'3 ran',
'3 passed',
'0 skipped',
'0 failed'
]
]
const FLAKY_TABLE = [
[
{
'data': 'Test',
'header': true
},
{
'data': 'Retries',
'header': true
}
]
]

describe('buildSummaryTables', () => {
it('should build simple tables', async () => {
const testResult = await parseTestReports(
Expand All @@ -22,83 +66,98 @@ describe('buildSummaryTables', () => {

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

expect(table).toStrictEqual([
expect(table).toStrictEqual(NORMAL_TABLE)
expect(detailTable).toStrictEqual([
[
{
'data': '',
'header': true
},
{
'data': 'Tests',
'header': true
},
{
'data': 'Passed ✅',
'header': true
"data": "Test",
"header": true
},
{
'data': 'Skipped ⏭️',
'header': true
},
"data": "Result",
"header": true
}
],
[
{
'data': 'Failed ❌',
'header': true
"data": "<strong>checkName</strong>",
"colspan": "2"
}
],
[
'checkName',
'3 ran',
'3 passed',
'0 skipped',
'0 failed'
"ABC-0199: XMPP Ping/PingIntegrationTest.pingAsync (Normal)",
"✅ pass"
],
[
"ABC-0199: XMPP Ping/PingIntegrationTest.pingServer (Normal)",
"✅ pass"
],
[
"ABC-0045: Multi-User Chat/MultiUserIntegrationTest.mucRoleTestForReceivingModerator (Normal)",
"✅ pass"
]
])
expect(flakyTable).toStrictEqual(FLAKY_TABLE)
})

it('should group detail tables', async () => {
const testResult = await parseTestReports(
'checkName',
'summary',
'test_results/nested/multi-level.xml',
'*',
true,
true,
[],
'{{SUITE_NAME}}/{{TEST_NAME}}',
'/'
)

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

expect(table).toStrictEqual(NORMAL_TABLE)
expect(detailTable).toStrictEqual([
[
{
'data': '',
'header': true
"data": "Test",
"header": true
},
{
'data': 'Test',
'header': true
},
"data": "Result",
"header": true
}
],
[
{
'data': 'Result',
'header': true
"data": "<strong>checkName</strong>",
"colspan": "2"
}
],
[
'checkName',
'XEP-0199: XMPP Ping/PingIntegrationTest.pingAsync (Normal)',
'✅ pass'
{
"data": "<em>ABC-0199: XMPP Ping</em>",
"colspan": "2"
}
],
[
'checkName',
'XEP-0199: XMPP Ping/PingIntegrationTest.pingServer (Normal)',
'✅ pass'
"ABC-0199: XMPP Ping/PingIntegrationTest.pingAsync (Normal)",
"✅ pass"
],
[
'checkName',
'XEP-0045: Multi-User Chat/MultiUserChatRolesAffiliationsPrivilegesIntegrationTest.mucRoleTestForReceivingModerator (Normal)',
'✅ pass'
]
])
expect(flakyTable).toStrictEqual([
"ABC-0199: XMPP Ping/PingIntegrationTest.pingServer (Normal)",
"✅ pass"
],
[
{
'data': '',
'header': true
},
{
'data': 'Test',
'header': true
},
{
'data': 'Retries',
'header': true
"data": "<em>ABC-0045: Multi-User Chat</em>",
"colspan": "2"
}
],
[
"ABC-0045: Multi-User Chat/MultiUserIntegrationTest.mucRoleTestForReceivingModerator (Normal)",
"✅ pass"
]
])
expect(flakyTable).toStrictEqual(FLAKY_TABLE)
})
})
4 changes: 2 additions & 2 deletions __tests__/testParser.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Annotation, parseFile, parseTestReports, resolveFileAndLine, resolvePath, Transformer} from '../src/testParser'
import {parseFile, parseTestReports, resolveFileAndLine, resolvePath, Transformer} from '../src/testParser'

/**
* Original test cases:
Expand Down Expand Up @@ -1308,7 +1308,7 @@ describe('parseTestReports', () => {
foundFiles: 1,
globalAnnotations: [],
passed: 0,
annotations: []
testResults: []
})
})
})
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ inputs:
description: 'Include table with all flaky results in summary'
required: false
default: 'false'
group_suite:
description: 'If enabled, will group the testcases by test suite in the `detailed_summary`'
required: false
default: 'false'
comment:
description: 'Enables a comment being added to the PR with the summary tables (summary has to be enabled). Default: false'
required: false
Expand Down
Loading

0 comments on commit ec3a351

Please sign in to comment.