You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+50-5Lines changed: 50 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,11 +9,13 @@ Produce an easy-to-read summary of your project's test data as part of your GitH
9
9
* Integrates easily with your existing GitHub Actions workflow
10
10
* Produces summaries from JUnit XML and TAP test output
11
11
* Compatible with most testing tools for most development platforms
12
-
* Customizable to show just a summary, just failed tests, or all test results.
12
+
* Produces step outputs, so you can pass summary data to other actions
13
+
* Customizable to show just a summary, just failed tests, or all test results
14
+
* Output can go to the [GitHub job summary](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary) (default), to a file or `stdout`
13
15
14
16
Getting Started
15
17
---------------
16
-
To set up the test summary action, just add a few lines of YAML to your GitHub Actions workflow. For example, if your test harness produces JUnit XML outputs in the `test/results/` directory, and you want to produce a test summary in a file named `test-summary.md`, add a new step to your workflow YAML after your build and test step:
18
+
To set up the test summary action, just add a few lines of YAML to your GitHub Actions workflow. For example, if your test harness produces JUnit XML outputs in the `test/results/` directory, and you want the output attached to the job summary, add a new step to your workflow YAML after your build and test step:
17
19
18
20
```yaml
19
21
- name: Test Summary
@@ -37,11 +39,20 @@ Update `paths` to match the test output file(s) that your test harness produces.
37
39
38
40
> Note the `if: always()` conditional in this workflow step: you should always use this so that the test summary creation step runs _even if_ the previous steps have failed. This allows your test step to fail -- due to failing tests -- but still produce a test summary.
39
41
40
-
Upload the markdown
41
-
-------------------
42
-
The prior "getting started" step generates a summary in GitHub-flavored Markdown (GFM). Once the markdown is generated, you can upload it as a build artifact, add it to a pull request comment, or add it to an issue. For example, to upload the markdown generated in the prior example as a build artifact:
42
+
Generating and uploading a markdown file
43
+
----------------------------------------
44
+
You can also generate the summary in a GitHub-flavored Markdown (GFM) file, and upload it as a build artifact, add it to a pull request comment, or add it to an issue. Use the `output` parameter to define the target file.
45
+
46
+
For example, to create a summary and upload the markdown as a build artifact:
43
47
44
48
```yaml
49
+
- name: Test Summary
50
+
uses: test-summary/action@v2
51
+
with:
52
+
paths: "test/results/**/TEST-*.xml"
53
+
output: test-summary.md
54
+
if: always()
55
+
45
56
- name: Upload test summary
46
57
uses: actions/upload-artifact@v3
47
58
with:
@@ -50,6 +61,29 @@ The prior "getting started" step generates a summary in GitHub-flavored Markdown
50
61
if: always()
51
62
```
52
63
64
+
Outputs
65
+
-------
66
+
This action also generates several outputs you can reference in other steps, or even from your job or workflow. These outputs are `passed`, `failed`, `skipped`, and `total`.
67
+
68
+
For example, you may want to send a summary to Slack:
There are examples for setting up a GitHub Actions step with many different platforms [in the examples repository](https://github.com/test-summary/examples).
@@ -94,13 +128,24 @@ Options are specified on the [`with` map](https://docs.github.com/en/actions/usi
94
128
```yaml
95
129
- uses: test-summary/action@v2
96
130
with:
131
+
paths: "test/results/**/TEST-*.xml"
97
132
output: "test/results/summary.md"
98
133
```
99
134
100
135
If this is not specified, the output will be to the workflow summary.
101
136
102
137
This file is [GitHub Flavored Markdown (GFM)](https://github.github.com/gfm/) and may include permitted HTML.
103
138
139
+
* **`show`: the test results to summarize in a table** (optional)
140
+
This controls whether a test summary table is created or not, as well as what tests are included. It could be `all`, `none`, `pass`, `skip`, or `fail`. The default is `fail` - that is, the summary table will only show the failed tests. For example, if you wanted to show failed and skipped tests:
141
+
142
+
```yaml
143
+
- uses: test-summary/action@v2
144
+
with:
145
+
paths: "test/results/**/TEST-*.xml"
146
+
show: "fail, skip"
147
+
```
148
+
104
149
FAQ
105
150
---
106
151
* **How is the summary graphic generated? Does any of my data ever leave GitHub?**
0 commit comments