diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-17 18:09:44 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-17 18:09:44 +0000 |
commit | 2c156e3c7bbade01c36eee18327f1ced6eebea79 (patch) | |
tree | 115fa8dbf6bc05037378b380311d31acb805f54c /doc/user | |
parent | 8e129497b2565b8c595ef4f806d9a9595ca654e5 (diff) | |
download | gitlab-ce-2c156e3c7bbade01c36eee18327f1ced6eebea79.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/user')
-rw-r--r-- | doc/user/gitlab_com/index.md | 1 | ||||
-rw-r--r-- | doc/user/project/merge_requests/img/test_coverage_visualization_v12_9.png | bin | 0 -> 55119 bytes | |||
-rw-r--r-- | doc/user/project/merge_requests/index.md | 1 | ||||
-rw-r--r-- | doc/user/project/merge_requests/test_coverage_visualization.md | 78 |
4 files changed, 80 insertions, 0 deletions
diff --git a/doc/user/gitlab_com/index.md b/doc/user/gitlab_com/index.md index b81426d9089..7d0614d411a 100644 --- a/doc/user/gitlab_com/index.md +++ b/doc/user/gitlab_com/index.md @@ -76,6 +76,7 @@ Below are the current settings regarding [GitLab CI/CD](../../ci/README.md). | Artifacts [expiry time](../../ci/yaml/README.md#artifactsexpire_in) | kept forever | deleted after 30 days unless otherwise specified | | Scheduled Pipeline Cron | `*/5 * * * *` | `19 * * * *` | | [Max jobs in active pipelines](../../administration/instance_limits.md#number-of-jobs-in-active-pipelines) | `500` for Free tier, unlimited otherwise | Unlimited +| [Max pipeline schedules in projects](../../administration/instance_limits.md#number-of-pipeline-schedules) | `10` for Free tier, `50` for all paid tiers | Unlimited | ## Repository size limit diff --git a/doc/user/project/merge_requests/img/test_coverage_visualization_v12_9.png b/doc/user/project/merge_requests/img/test_coverage_visualization_v12_9.png Binary files differnew file mode 100644 index 00000000000..c2cd28adc95 --- /dev/null +++ b/doc/user/project/merge_requests/img/test_coverage_visualization_v12_9.png diff --git a/doc/user/project/merge_requests/index.md b/doc/user/project/merge_requests/index.md index 8281de33e5f..f296c3fbd8c 100644 --- a/doc/user/project/merge_requests/index.md +++ b/doc/user/project/merge_requests/index.md @@ -102,6 +102,7 @@ or link to useful information directly in the merge request page: | [Multi-Project pipelines](../../../ci/multi_project_pipelines.md) **(PREMIUM)** | When you set up GitLab CI/CD across multiple projects, you can visualize the entire pipeline, including all cross-project interdependencies. | | [Pipelines for merge requests](../../../ci/merge_request_pipelines/index.md) | Customize a specific pipeline structure for merge requests in order to speed the cycle up by running only important jobs. | | [Pipeline Graphs](../../../ci/pipelines/index.md#visualizing-pipelines) | View the status of pipelines within the merge request, including the deployment process. | +| [Test Coverage visualization](test_coverage_visualization.md) | See test coverage results for merge requests, within the file diff. | ### Security Reports **(ULTIMATE)** diff --git a/doc/user/project/merge_requests/test_coverage_visualization.md b/doc/user/project/merge_requests/test_coverage_visualization.md new file mode 100644 index 00000000000..a0a4c5d3743 --- /dev/null +++ b/doc/user/project/merge_requests/test_coverage_visualization.md @@ -0,0 +1,78 @@ +--- +type: reference, howto +--- + +# Test Coverage Visualization + +> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/3708) in GitLab 12.9. + +With the help of [GitLab CI/CD](../../../ci/README.md), you can collect the test +coverage information of your favorite testing or coverage-analysis tool, and visualize +this information inside the file diff view of your merge requests (MRs). This will allow you +to see which lines are covered by tests, and which lines still require coverage, before the +MR is merged. + +![Test Coverage Visualization Diff View](img/test_coverage_visualization_v12_9.png) + +## How test coverage visualization works + +Collecting the coverage information is done via GitLab CI/CD's +[artifacts reports feature](../../../ci/yaml/README.md#artifactsreports). +You can specify one or more coverage reports to collect, including wildcard paths. +GitLab will then take the coverage information in all the files and combine it +together. + +For the coverage analysis to work, you have to provide a properly formated +[Cobertura XML](https://cobertura.github.io/cobertura/) report to +[`artifacts:reports:cobertura`](../../../ci/yaml/README.md#artifactsreportscobertura). +This format was originally developed for Java, but most coverage analysis frameworks +for other languages have plugins to add support for it, like: + +- [simplecov-cobertura](https://rubygems.org/gems/simplecov-cobertura) (Ruby) +- [gocover-cobertura](https://github.com/t-yuki/gocover-cobertura) (Golang) + +Other coverage analysis frameworks support the format out of the box, for example: + +- [Istanbul](https://istanbul.js.org/docs/advanced/alternative-reporters/#cobertura) (JavaScript) +- [Coverage.py](https://coverage.readthedocs.io/en/coverage-5.0/cmd.html#xml-reporting) (Python) + +Once configured, if you create a merge request that triggers a pipeline which collects +coverage reports, the coverage will be shown in the diff view. This includes reports +from any job in any stage in the pipeline. The coverage will be displayed for each line: + +- `covered` (green): lines which have been checked at least once by tests +- `no test coverage` (orange): lines which are loaded but never executed +- no coverage information: lines which are non-instrumented or not loaded + +Hovering over the coverage bar will provide further information, such as the number +of times the line was checked by tests. + +## Example test coverage configuration + +The following [`gitlab-ci.yml`](../../../ci/yaml/README.md) example uses [Mocha](https://mochajs.org/) +JavaScript testing and [NYC](https://github.com/istanbuljs/nyc) coverage-tooling to +generate the coverage artifact: + +```yaml +test: + script: + - npm install + - npx nyc --reporter cobertura mocha + artifacts: + reports: + cobertura: coverage/cobertura-coverage.xml +``` + +## Enabling the feature + +This feature comes with the `:coverage_report_view` feature flag disabled by +default. This feature is disabled due to some performance issues with very large +data sets. When [the performance issue](https://gitlab.com/gitlab-org/gitlab/issues/37725) +is resolved, the feature will be enabled by default. + +To enable this feature, ask a GitLab administrator with Rails console access to +run the following command: + +```ruby +Feature.enable(:coverage_report_view) +``` |