在 GitHub Actions CI/CD 工作流程和拉取请求中直接发布和查看测试报告,包含详细的测试摘要、失败测试分析和不稳定测试结果。
在 GitHub Actions CI/CD 工作流程和拉取请求中直接发布和查看测试报告,包含详细的测试摘要、失败测试分析和不稳定测试结果。
Integrate Test Reporting into Your GitHub Actions Workflow
A GitHub test reporting tool that supports all major testing frameworks. Generate, publish and alert your team with detailed test results, including summaries, in-depth reports, failed test analyses, flaky test detection and AI analyses directly within your GitHub Actions CI/CD workflow and Pull Requests.
Choose from a variety of pre-built reports or create custom reports tailored to your project's needs, ensuring that test results are always where you need them.
GitHub Test Reporter is community-built and open source.
You can support the project by:
** Post anywhere:** job summaries, pull requests, checks, issues, inline annotations, and other developer tools
** Built-in insights:** failures, flaky tests, and duration trends across hundreds of runs
** Super flexible:** start fast with powerful built-in reports or go fully custom with your own templates
** AI summary:** summarize test results with AI and get explanations of them with contextual insights
** Framework-agnostic:** works with any testing tool
To get started quickly add the following to your workflow file:
- name: Publish Test Report
uses: ctrf-io/github-test-reporter@v1
with:
report-path: './ctrf/*.json'
github-report: true
if: always()Add upload-artifact: true, fetch-previous-results: true and a GITHUB_TOKEN to enable comparisons.
To get started with multi run insights on failures, flakiness and test duration, add the following to your workflow file:
- name: Publish Test Report with Insights
uses: ctrf-io/github-test-reporter@v1
with:
report-path: './ctrf/*.json'
summary-delta-report: true
insights-report: true
flaky-rate-report: true
fail-rate-report: true
slowest-report: true
upload-artifact: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: always()This will create a job summary with insights on failures, flakiness and test duration.
To get started with pull request comments, add the following to your workflow file:
- name: Publish Test Report with Pull Request Comment
uses: ctrf-io/github-test-reporter@v1
with:
report-path: './ctrf/*.json'
pull-request-report: true
if: always()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}Make sure your GitHub Token has pull request write permission.
This will create a pull request comment with a summary of the test results.
These are just a few examples of the many ways the GitHub Test Reporter can be used. It is super flexible and can be used in a variety of ways. Continue reading to learn more about the many features and options available.
There are a variety of built-in reports to choose from. Checkout the built-in reports
You need a CTRF or JUnit report.
This reporter works best with CTRF as it's packed with modern properties. CTRF reporters are available for most testing frameworks and easy to install.
For more details on using JUnit, see JUnit integration instructions
Don't see a reporter for your testing framework? Consider contributing
For more advanced usage, there are several inputs available.
…Only report-path is required.
You can add a pull request comment by using the pull-request-report input:
- name: Publish Test Report
uses: ctrf-io/github-test-reporter@v1
with:
report-path: './ctrf/*.json'
pull-request-report: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: always()This uses the built-in pull request comment report.
Additionally, you can add any report to a pull request comment by adding the
pull-request input:
- name: Publish Test Report
uses: ctrf-io/github-test-reporter@v1
with:
report-path: './ctrf/*.json'
flaky-rate-report: true
pull-request: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: always()The pull-request input works with all reports, including custom.
requires a GITHUB_TOKEN with pull request write permission.
Note: Special considerations apply to pull requests from forks. See Fork Pull Requests for details.
You can also comment on a specific issue or pull request by using the issue
input and providing the issue number ():
- name: Publish Test Report
uses: ctrf-io/github-test-reporter@v1
with:
report-path: './ctrf/*.json'
issue: '123'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: always()Requires a GITHUB_TOKEN with issue or pull request write permission.
The issue or pull request can live in a different repository than the one
running the workflow — useful when an orchestration repository runs the tests
but the results belong on a pull request in another repository. Set
issue-repo in owner/repo format and provide a token with write access to
that repository:
- name: Publish Test Report
uses: ctrf-io/github-test-reporter@v1
with:
report-path: './ctrf/*.json'
issue: '123'
issue-repo: 'my-org/my-other-repo'
env:
GITHUB_TOKEN: ${{ secrets.CROSS_REPO_TOKEN }}
if: always()update-comment An existing tagged comment is found, the new report is
appended to it. Otherwise, a new comment is created.
overwrite-comment An existing tagged comment is found, that comment's entire
content is replaced with the new report. Otherwise, a new comment is created.
always-latest-comment Create a new comment if the existing comment is not the latest in the thread. Use with update-comment or overwrite-comment. Default is false
comment-tag A unique identifier for comments posted. Used to find and
update/overwrite existing comments.
For example, the following command creates or updates a comment tagged with the current workflow and job names:
- name: Publish Test Report
uses: ctrf-io/github-test-reporter@v1
with:
report-path: './ctrf/*.json'
flaky-rate-report: true
pull-request: true
update-comment: true
comment-tag: '${{ github.workflow }}-${{ github.job }}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: always()The status-check input creates a status check for the workflow.
- name: Publish Test Report
uses: ctrf-io/github-test-reporter@v1
with:
report-path: './ctrf/*.json'
status-check: true
status-check-name: 'GitHub Test Reporter Results'
if: always()Requires a GITHUB_TOKEN with status check write permission.
The custom-report input lets you build your own report using a Handlebars
template. The template can include any markdown content and leverage data from
your CTRF report and GitHub properties, allowing for dynamic and customizable
report.
Add the following to your workflow file:
- name: Publish Test Report
uses: ctrf-io/github-test-reporter@v1
with:
report-path: './ctrf/*.json'
template-path: './templates/custom-report.hbs'
custom-report: true
if: always()For detailed instructions on building your own report, see the documentation.
For inspiration, check out the built-in reports and community reports
We welcome and encourage contributions of community-built reports. Community reports allow users to share custom reports designed for specific use cases.
To submit a community-built report create a Pull Request.
You can see available community built reports
Add the following to your workflow file:
- name: Publish Test Report
uses: ctrf-io/github-test-reporter@v1
with:
report-path: './ctrf/*.json'
community-report: true
community-report-name: summary-short
if: always()The GitHub Test Reporter allows you to customize the order in which reports appear in your job summary or pull request comments. This feature gives you complete control over how your test results are presented. To customize the order of reports, use the report-order parameter with a comma-separated list of report types:
- name: Publish Test Report
uses: ctrf-io/github-test-reporter@v1
with:
report-path: './ctrf/*.json'
summary-report: true
failed-report: true
flaky-report: true
insights-report: true
test-report: true
# Order reports with the most important information first
report-order: 'summary-report,failed-report,flaky-report,insights-report,test-report'
if: always()If report-order is not provided, a default order is used.
previous-results-report, insights-report, flaky-rate-report, fail-rate-report, and slowest-report need a
GITHUB_TOKEN:
- name: Publish Test Report
uses: ctrf-io/github-test-reporter@v1
with:
report-path: './ctrf/*.json'
flaky-rate-report: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: always()Some reports require you to store CTRF reports as artifacts, use the
upload-artifact input for full capabilities:
- name: Upload test results
uses: ctrf-io/github-test-reporter@v1
with:
report-path: './ctrf/*.json'
upload-artifact: true
if: always()previous-results-report, flaky-rate-report and fail-rate-report filter
previous results as follows:
This ensures that you only see workflow runs that are related to your current branch or pull request
You can specify a baseline report to use for delta and metrics comparison using the baseline or baseline-report-path inputs.
baseline: Specify a baseline report by providing either a number (e.g., 1 for the last run, 2 for the run before that) or a string representing the report ID. This allows you to compare your current test results against a specific previous run. The default value is 1, which uses the most recent previous report as the baseline.
baseline-report-path: Provide a path to a specific CTRF report file to use as the baseline for comparison. This is useful if you want to compare against a particular report that is on the filesystem.
CTRF tooling offers seamless developer tool integration, allowing you to combine the GitHub Test Reporter with the following tools:
| Integration | Description | Repository |
|---|---|---|
| Slack Test Reporter | Send |
暂无开放 Issues,或尚未同步最近议题。