Skip to main content

View tests

Your CI pipelines can run tests in Run steps and Run Tests steps. To publish test results and view them in Harness, you must add the Report Paths setting to the relevant step, for example:

              - step:
type: Run
name: Run Ruby Tests
identifier: run_ruby_tests
spec:
shell: Sh
command: |-
bundle exec rake test --junit
reports:
type: JUnit
spec:
paths:
- report.xml

Publish reports to the Tests tab

If the test reports are in JUnit XML format, you can review test reports on the Tests tab on the Build details page.

If you are using Test Intelligence for your unit tests, the Tests tab contains information unique to Test Intelligence. For details about this, go to Enable Test Intelligence.

Test report dashboard

note

Currently, the Unit Test Metrics dashboard is behind the feature flag CI_TI_DASHBOARDS_ENABLED. Contact Harness Support to enable the feature.

The Unit Test Metrics dashboard aggregates data from test reports in JUnit XML format. The dashboard reports the overall failure rate and the overall success rate. The dashboard breaks down failure data by pipeline, Git repo, and test. You can filter by project, pipeline, and date range.

You can find this and other dashboards under the Dashboards section of your Harness account.

Troubleshooting: Test suites incorrectly parsed

The parsed test report in the Tests tab comes strictly from the provided test reports. Test reports must be in JUnit XML format to appear on the Tests tab, because Harness parses test reports that are in JUnit XML format only. It is important to adhere to the standard JUnit format to improve test suite parsing. For more information, go to Format test reports.

View reports on the Artifacts tab

For reports that can't be published to the Tests tab, you can use the Artifact Metadata Publisher Drone plugin to publish reports to the Artifacts tab on the Build details page. You can publish any URL to the Artifacts tab.

  1. Include steps in your pipeline that run tests and produce test reports.

  2. Include a step to upload the report artifact to cloud storage, such as Upload Artifacts to GCS, Upload Artifacts to S3, or Upload Artifacts to JFrog Artifactory.

  3. Include a Plugin step that uses the artifact-metadata-publisher plugin, for example:

                   - step:
    type: Plugin
    name: publish artifact metadata
    identifier: publish_artifact_metadata
    spec:
    connectorRef: account.harnessImage
    image: plugins/artifact-metadata-publisher
    settings:
    file_urls: ## Provide the URL to the target artifact that was uploaded in the Upload Artifacts step.
    artifact_file: artifact.txt