diff options
Diffstat (limited to 'doc/ci/junit_test_reports.md')
-rw-r--r-- | doc/ci/junit_test_reports.md | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/doc/ci/junit_test_reports.md b/doc/ci/junit_test_reports.md index aa0d40a4d06..aedda3c8341 100644 --- a/doc/ci/junit_test_reports.md +++ b/doc/ci/junit_test_reports.md @@ -73,6 +73,7 @@ For a list of supported languages on JUnit tests, check the To enable the JUnit reports in merge requests, you need to add [`artifacts:reports:junit`](pipelines/job_artifacts.md#artifactsreportsjunit) in `.gitlab-ci.yml`, and specify the path(s) of the generated test reports. +The reports must be `.xml` files, otherwise [GitLab returns an Error 500](https://gitlab.com/gitlab-org/gitlab/-/issues/216575). In the following examples, the job in the `test` stage runs and GitLab collects the JUnit test report from each job. After each job is executed, the @@ -103,7 +104,8 @@ ruby: ### Go example -Use the following job in `.gitlab-ci.yml`: +Use the following job in `.gitlab-ci.yml`, and ensure you use `-set-exit-code`, +otherwise the pipeline will be marked successful, even if the tests fail: ```yaml ## Use https://github.com/jstemmer/go-junit-report to generate a JUnit report with go @@ -111,7 +113,7 @@ golang: stage: test script: - go get -u github.com/jstemmer/go-junit-report - - go test -v 2>&1 | go-junit-report > report.xml + - go test -v 2>&1 | go-junit-report -set-exit-code > report.xml artifacts: reports: junit: report.xml @@ -206,7 +208,7 @@ cunit: junit: ./my-cunit-test.xml ``` -### .Net example +### .NET example The [JunitXML.TestLogger](https://www.nuget.org/packages/JunitXml.TestLogger/) NuGet package can generate test reports for .Net Framework and .Net Core applications. The following @@ -234,7 +236,9 @@ Test: ## Viewing JUnit test reports on GitLab -> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/24792) in GitLab 12.5. +> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/24792) in GitLab 12.5. +> - It's deployed behind a feature flag, disabled by default. +> - To use it in GitLab self-managed instances, ask a GitLab administrator to [enable it](#enabling-the-junit-test-reports-feature-core-only). **(CORE ONLY)** If JUnit XML files are generated and uploaded as part of a pipeline, these reports can be viewed inside the pipelines details page. The **Tests** tab on this page will @@ -248,7 +252,7 @@ with failed showing at the top, skipped next and successful cases last. You can also retrieve the reports via the [GitLab API](../api/pipelines.md#get-a-pipelines-test-report). -### Enabling the feature +### Enabling the JUnit test reports feature **(CORE ONLY)** This feature comes with the `:junit_pipeline_view` feature flag disabled by default. This feature is disabled due to some performance issues with very large data sets. @@ -260,13 +264,15 @@ following command: ```ruby Feature.enable(:junit_pipeline_view) -# Enable the feature for a specific project +# Enable the feature for a specific project, GitLab 13.0 and above only. Feature.enable(:junit_pipeline_view, Project.find(<your-project-id-here>)) ``` ## Viewing JUnit screenshots on GitLab -> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/202114) in GitLab 13.0. +> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/202114) in GitLab 13.0. +> - It's deployed behind a feature flag, disabled by default. +> - To use it in GitLab self-managed instances, ask a GitLab administrator to [enable it](#enabling-the-junit-screenshots-feature-core-only). **(CORE ONLY)** If JUnit XML files contain an `attachment` tag, GitLab parses the attachment. @@ -280,7 +286,7 @@ Upload your screenshots as [artifacts](pipelines/job_artifacts.md#artifactsrepor When [this issue](https://gitlab.com/gitlab-org/gitlab/-/issues/6061) is complete, the attached file will be visible on the pipeline details page. -### Enabling the feature +### Enabling the JUnit screenshots feature **(CORE ONLY)** This feature comes with the `:junit_pipeline_screenshots_view` feature flag disabled by default. |