Use this action to publish test results if you are using a CloudBees platform workflow. This action supports many popular testing tools, and enables testing results from platform workflow run to be displayed in the Test results tab of Run details and in the Test insights analytics dashboard.
All CloudBees action repositories are listed at CloudBees, Inc. on GitHub. |
Inputs
Input name | Data type | Required | Description |
---|---|---|---|
|
String |
Yes |
The name of the testing tool[1]. |
|
String |
Yes |
The pattern, file, or directory path of the test report to convert. |
[1] The testing tool name must be formatted correctly, in either all lowercase, or all uppercase.
Supported testing tools
Only the testing tools listed in the table below are supported for use in this action. |
Use the given test-type
input format to specify a testing tool.
Supported tool name |
Accepted |
|
---|---|---|
lowercase |
UPPERCASE |
|
GO |
|
|
Jest |
|
|
JMeter |
|
|
JUnit |
|
|
MSTest |
|
|
Playwright |
|
|
ProdPerfect |
|
|
Selenium |
|
|
TestNG |
|
|
Tosca |
|
|
Usage examples
Basic example
The following is a basic example of using the action:
- name: Publish test results uses: cloudbees-io/publish-test-results@v2 with: test-type: TESTNG results-path: /example/mytest
Go test example
To use the GO testing tool, you must first capture the output into a log, and then convert the log into a JUnit test report. Then you can use this action to publish the test results to the CloudBees platform.
In the following example, the following external tools are used to capture the data and create a test report:
-
Go CTRF JSON format support to create test reports that follow the Common Test Report Format (CTRF) standard.
apiVersion: automation.cloudbees.io/v1alpha1 kind: workflow name: GO-test on: push: branches: - main jobs: GO-testing: steps: - name: Check out source code uses: cloudbees-io/checkout@v1 with: repository: gh-org/my-repo ref: main token: ${{ secrets.GIT_PAT }} - name: Get test reports uses: docker://golang:1.22-alpine shell: sh run: | export PATH="${PATH}:${GOPATH}/bin" go install github.com/jstemmer/go-junit-report@latest go install github.com/ctrf-io/go-ctrf-json-reporter/cmd/go-ctrf-json-reporter@latest mkdir ${{ cloudbees.workspace }}/test_reports go clean go test -v 2>&1 ./... | go-junit-report > ${{ cloudbees.workspace }}/test_reports/report.xml go test -json ./... | go-ctrf-json-reporter -output ${{ cloudbees.workspace }}/test_reports/report.json - name: Publish test results to platform uses: cloudbees-io/publish-test-results@v1 with: folder-name: ${{ cloudbees.workspace }}/test_reports test-type: go
After the run has completed, the test report is displayed in both
and in the CloudBees platform.
Playwright test example
In the following example, source code from a repository is checked out in the CloudBees platform and tested with the Playwright tool. After configuring AWS credentials, the test results are compressed and archived using Docker. The test results are uploaded to an AWS S3 bucket and published as evidence in the CloudBees platform.