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: docs/reports.md
+56-59Lines changed: 56 additions & 59 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,15 +5,23 @@ title: Reporters
5
5
6
6
# Reporters
7
7
8
-
CodeceptJS prints test results to the console by default (see [CLI output](#cli-output)). For an HTML report, a pull-request comment, JUnit XML, or a hosted dashboard, it is recommeded to use **[Testomat.io Reporter](https://github.com/testomatio/reporter)**. It sends results to whichever destinations you turn on with steps, screenshots, videos, traces, and logs.
8
+
CodeceptJS prints test results to the console by default (see [CLI output](#cli-output)). For an HTML report, a pull-request comment, JUnit XML, or a hosted dashboard, use **[Testomat.io Reporter](https://github.com/testomatio/reporter)**.
9
+
10
+
Testomat.io Reporter is open source. It can send create reports of various types:
11
+
12
+
-**Local files** — HTML, CSV, and Markdown reports written to disk.
13
+
-**CI/CD pipeline reports** — reports added as comments to GitHub, GitLab, or Bitbucket pull requests.
14
+
-**Cloud Services** — a hosted dashboard on [app.testomat.io](https://testomat.io) to keep track of results history and get analytics.
15
+
16
+
You choose the destinations. The reporter collects steps, screenshots, videos, traces, and logs once and sends them everywhere you enabled.
9
17
10
18
### Install
11
19
12
20
```sh
13
21
npm install @testomatio/reporter --save-dev
14
22
```
15
23
16
-
Enable reporter plugin:
24
+
Enable the reporter plugin and turn on the local reports you want:
17
25
18
26
```js
19
27
// codecept.conf.js
@@ -22,122 +30,109 @@ plugins: {
22
30
enabled:true,
23
31
require:'@testomatio/reporter/codecept',
24
32
html:true,
25
-
markdown:true,
26
-
csv:true,
27
-
reportDir:'output/report',
33
+
//markdown: true,
34
+
//csv: true,
35
+
//reportDir: 'output/report',
28
36
},
29
37
}
30
38
```
31
39
32
-
The local reports above are enabled directly from CodeceptJS config. If `reportDir` is omitted, reports are written to `output/report` using the CodeceptJS `output` directory.
40
+
> `html`, `markdown`, and `csv` are config switches for local reports. Local reports are stored in filesystem in `output/report` dir by default.
41
+
42
+
### Local reports and remote destinations
33
43
34
-
### Enable an output
44
+
Local reports are turned on with config switches and saved to disk:
35
45
36
-
Each output can also be enabled with environment variables. Run your tests as usual and one run feeds every output you enabled.
46
+
| Config switch | File in `reportDir`|
47
+
| --- | --- |
48
+
|`html: true`|`testomatio-report.html`|
49
+
|`markdown: true`|`testomatio-report.md`|
50
+
|`csv: true`|`report.csv`|
37
51
38
-
| To get… | Set | Details |
39
-
| --- | --- | --- |
40
-
| HTML report |`TESTOMATIO_HTML_REPORT_SAVE=1`|[HTML Report](#html-report)|
| Run Result on [app.testomat.io](https://testomat.io)|`TESTOMATIO` (project API key) |[Cloud Report](#cloud-report)|
43
-
| A comment on a GitHub Pull Request |`GH_PAT` (`${{ github.token }}` in Actions) |[GitHub Report](#github-report)|
44
-
| A comment on a GitLab Merge Request |`GITLAB_PAT` (token with `api` scope) |[GitLab Report](#gitlab-report)|
45
-
| A comment on a Bitbucket Pull Request |`BITBUCKET_ACCESS_TOKEN` (repo access token) |[Bitbucket Report](#bitbucket-report)|
52
+
Remote destinations need an access token. A token is a secret, so pass it through an environment variable or CI secret instead of committing it to the config file:
46
53
47
-
Screenshots and videos in these reports are uploaded to your own storage — see [Artifacts](#artifacts).
54
+
| Destination | Token variable |
55
+
| --- | --- |
56
+
| Run result on [app.testomat.io](https://testomat.io)|`TESTOMATIO`|
57
+
| Comment on a GitHub Pull Request |`GH_PAT` (`${{ github.token }}` in Actions) |
58
+
| Comment on a GitLab Merge Request |`GITLAB_PAT` (token with `api` scope) |
59
+
| Comment on a Bitbucket Pull Request |`BITBUCKET_ACCESS_TOKEN` (repo access token) |
48
60
49
-
Put the variables on CI when running tests:
61
+
One run feeds every destination you enabled. On CI, keep the report switches in the config and pass only the tokens as environment variables:
The GitHub pipe also needs the job to grant `permissions: pull-requests: write`.
75
+
The GitHub destination also needs the job to grant `permissions: pull-requests: write`.
66
76
77
+
For the full list of options and environment variables, see the [reporter configuration reference](https://github.com/testomatio/reporter/blob/master/docs/configuration.md).
67
78
68
79
### HTML Report
69
80
70
-
A single self-contained HTML file with the run summary and, per test, its steps, screenshots, logs, and error. It needs no API key and no service, so it works anywhere — open it locally or attach it to a CI build.
81
+
A local, self-contained HTML file saved to `output/report/testomatio-report.html`. It holds the run summary and, per test, its steps, screenshots, logs, and error. It needs no API key and no service, so it works anywhere — open it locally or attach it to a CI build.
- Preferred in CodeceptJS 4: enable `html: true` in `plugins.testomatio` and run `npx codeceptjs run`
85
+
Enable it with `html: true` in `plugins.testomatio` and run `npx codeceptjs run`. To change the file name or folder, see the [HTML pipe docs](https://github.com/testomatio/reporter/blob/master/docs/pipes/html.md).
75
86
76
-
- `TESTOMATIO_HTML_REPORT_SAVE=1`— enable the report
77
-
- `TESTOMATIO_HTML_REPORT_FOLDER=output/reports`— keep it inside CodeceptJS's `output/` dir (default folder is `html-report`)
78
-
- `TESTOMATIO_HTML_FILENAME`— file name, must end in `.html` (default `testomatio-report.html`)
87
+
### CSV Report
79
88
80
-
### Cloud Report
89
+
A local CSV file saved to `output/report/report.csv`, with one row per test — suite, title, and status. Use it in spreadsheets or data pipelines.
81
90
82
-
Sends the run to [app.testomat.io](https://testomat.io) — a hosted dashboard with run history, flaky-test detection, parallel-run merging, re-running failed tests, and notifications. Free for small teams.
91
+
Enable it with `csv: true` in `plugins.testomatio`. See the [CSV pipe docs](https://github.com/testomatio/reporter/blob/master/docs/pipes/csv.md).
A remote destination: the run is sent to [app.testomat.io](https://testomat.io), a hosted dashboard with run history, flaky-test detection, parallel-run merging, re-running failed tests, and notifications. Free for small teams.
85
96
86
-
- `TESTOMATIO`— project API key; enables the pipe
87
-
- `TESTOMATIO_CREATE=1`— create tests in Testomat.io that were not imported beforehand
88
-
- `TESTOMATIO_TITLE`— report title
89
-
- `TESTOMATIO_RUNGROUP_TITLE`— add the run to a group (e.g. `"Build ${BUILD_ID}"`)
90
-
- `TESTOMATIO_PUBLISH=1`— make the report publicly accessible
More options (shared runs, rungroups, run management): [Testomat.io pipe](https://github.com/testomatio/reporter/blob/master/docs/pipes/testomatio.md).
99
+
Set the `TESTOMATIO` environment variable to your project API key and run the tests. Run titles, run groups, shared runs, and publishing options: [Testomat.io pipe docs](https://github.com/testomatio/reporter/blob/master/docs/pipes/testomatio.md).
93
100
94
-
To view artifacts on cloud they must be uploaded to S3 storages. Images from [`screenshot`](/plugins#screenshot) plugin, videos from the [`screencast`](/plugins#screencast) plugin (or the Playwright helper's `video` and `trace`). Can be used with any S3 provider: AWS S3, Cloudflare R2, Google Cloud Storage (interoperability mode), DigitalOcean Spaces, MinIO.
101
+
To view artifacts on the cloud, upload them to S3 storage. Images come from the [`screenshot`](/plugins#screenshot) plugin, videos from the [`screencast`](/plugins#screencast) plugin (or the Playwright helper's `video` and `trace`). Any S3 provider works: AWS S3, Cloudflare R2, Google Cloud Storage (interoperability mode), DigitalOcean Spaces, MinIO.
95
102
96
103
### GitHub Report
97
104
98
-
Posts a comment to the Pull Request:run status, pass/fail/skip counts, stack traces of the failures, screenshots, and the slowest tests. Re-running the workflow replaces the previous comment.
105
+
A remote destination: a comment on the Pull Request with run status, pass/fail/skip counts, stack traces of the failures, screenshots, and the slowest tests. Re-running the workflow replaces the previous comment.
- `GH_PAT`— GitHub token; `${{ github.token }}` works in Actions
103
-
- the job must grant `permissions: pull-requests: write`
104
-
- `GH_KEEP_OUTDATED_REPORTS=1`— keep previous comments instead of deleting them
109
+
Set `GH_PAT` to a GitHub token (`${{ github.token }}` works in Actions) and grant the job `permissions: pull-requests: write`. More options: [GitHub pipe docs](https://github.com/testomatio/reporter/blob/master/docs/pipes/github.md).
105
110
106
111
### GitLab Report
107
112
108
-
Posts a comment to the Merge Request with the same summary. It needs Merge Request context, so run it in merge-request pipelines.
113
+
A remote destination: a comment on the Merge Request with the same summary. Run it in merge-request pipelines (`$CI_PIPELINE_SOURCE == "merge_request_event"`).
- `GITLAB_REMOVE_ALL_OUTDATED_REPORTS=1`— remove all previous comments, not just the latest
117
+
Set `GITLAB_PAT` to a Personal or Project Access Token with `api` scope. More options: [GitLab pipe docs](https://github.com/testomatio/reporter/blob/master/docs/pipes/gitlab.md).
116
118
117
119
### Bitbucket Report
118
120
119
-
Posts a comment to the Pull Request with the same summary. Comments are created only in `pull-requests` pipelines.
121
+
A remote destination: a comment on the Pull Request with the same summary. Comments are created only in `pull-requests` pipelines.
Set `BITBUCKET_ACCESS_TOKEN` to a repository access token with `Pull requests: Write` and `Repository: Read`. More options: [Bitbucket pipe docs](https://github.com/testomatio/reporter/blob/master/docs/pipes/bitbucket.md).
126
126
127
127
### Markdown Report
128
128
129
-
- Preferred in CodeceptJS 4: enable `markdown: true` in `plugins.testomatio` and run `npx codeceptjs run`
129
+
A local, self-contained Markdown file saved to `output/report/testomatio-report.md`. It renders in PR comments, CI job summaries, and Slack, and is convenient for AI agents reading test results. It needs no API key.
A single self-contained Markdown file — renders in PR comments, CI job summaries, and Slack, and is convenient for AI agents reading test results. Needs no API key.
134
-
135
-
- `TESTOMATIO_MARKDOWN_REPORT_SAVE=1`— enable the report
136
-
- `TESTOMATIO_MARKDOWN_REPORT_FOLDER=output/reports`— keep it inside CodeceptJS's `output/` dir (default folder is `md-report`)
137
-
- `TESTOMATIO_MARKDOWN_FILENAME`— file name, must end in `.md` (default `testomatio-report.md`)
138
-
- `TESTOMATIO_TITLE`— document title (default `Test Results`)
133
+
Enable it with `markdown: true` in `plugins.testomatio`. To change the file name, folder, or title, see the [Markdown pipe docs](https://github.com/testomatio/reporter/blob/master/docs/pipes/markdown.md).
139
134
140
-
On GitHub Actions, append it to the job summary: `cat output/reports/testomatio-report.md >> "$GITHUB_STEP_SUMMARY"`.
135
+
On GitHub Actions, append it to the job summary: `cat output/report/testomatio-report.md >> "$GITHUB_STEP_SUMMARY"`.
141
136
142
137
## JUnit XML
143
138
@@ -189,6 +184,8 @@ By default CodeceptJS prints test names and failures. Add `--steps` to see each
189
184
190
185
```sh
191
186
npx codeceptjs run --steps
187
+
npx codeceptjs run --debug
188
+
npx codeceptjs run --verbose
192
189
```
193
190
194
191
`dry-run` lists tests and steps without running them:
0 commit comments