From 0b64bdee58fbb79bbaa3a8a3169b2ba234663b7e Mon Sep 17 00:00:00 2001 From: HUYNH Kim-Tam <kim-tam.huynh@inria.fr> Date: Fri, 2 Dec 2022 17:25:04 +0100 Subject: [PATCH] Add code for decreasing coverage --- README.md | 21 +++++++++++++++------ codexample/functions.py | 6 ++++++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 860d4d9..8812335 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,10 @@ Requirements: * CI/CD is enabled: `Settings/General/Visibility, project features, permissions/Repository/'CI/CD'` * Shared runners are enabled : `Settings/'CI/CD'/Runners/Shared runners/Enable shared runners for this project` +Ref: +* [Gitlab docs: test reports](https://docs.gitlab.com/ee/ci/testing/unit_test_reports.html) +* [Gitlab docs: test coverage](https://docs.gitlab.com/ee/ci/testing/test_coverage_visualization.html) + The gitlab-ci configuration is written in the file [.gitlab-ci.yml](.gitlab-ci.yml). Gitlab may use test reports to provide some UI functionalities if you upload them as artifacts. @@ -31,18 +35,23 @@ tests: coverage: '/^TOTAL.+?(\d+\%)$/' ``` -Ref: -* [Gitlab docs: test reports](https://docs.gitlab.com/ee/ci/testing/unit_test_reports.html) -* [Gitlab docs: test coverage](https://docs.gitlab.com/ee/ci/testing/test_coverage_visualization.html) +You can download these artifacts on [Pipeline page](https://gitlab.inria.fr/gitlabci_gallery/testing/pytest-gitlab-reports/-/pipelines) with the download button on the right of a pipeline. + +## Visualization on Gitlab UI -## Test reports +### Test reports On [latest pipeline page](https://gitlab.inria.fr/gitlabci_gallery/testing/pytest-gitlab-reports/-/pipelines/main/latest), the Tests tab displays a list of test suites and cases reported from the XML file. -## Coverage +### Coverage + +#### In Analytics + +You can view a graph of coverage evolution on default branch in `Analytics` menu. +For example, on this project, it is visible at: https://gitlab.inria.fr/gitlabci_gallery/testing/pytest-gitlab-reports/-/graphs/main/charts. -### Adding coverage badge +#### Adding coverage badge To add a coverage badge to your project, go to `Settings/General/Badges` to add a badge. diff --git a/codexample/functions.py b/codexample/functions.py index 55b6f0f..3dd85eb 100644 --- a/codexample/functions.py +++ b/codexample/functions.py @@ -5,3 +5,9 @@ def return_value(value): def raise_error(msg_kw): raise ValueError(f"Exception {msg_kw} raised") + +def factorielle(n): + if n == 0: + return 1 + else: + return n * factorielle(n-1) -- GitLab