Skip to content
Snippets Groups Projects
Commit 1f997a18 authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

feat(JaCoCo): add JaCoCo Coverage Reports integration

parent af506b79
No related branches found
No related tags found
No related merge requests found
......@@ -89,14 +89,15 @@ to compute code coverage during unit tests execution.
In addition it makes the necessary to [integrate code coverage stats into your GitLab project](https://docs.gitlab.com/ee/ci/testing/code_coverage.html#view-code-coverage-results-in-the-mr) (report badge and viewable coverage in merge requests).
If yo want to fix the JaCoCo plugin version or tweak the default configuration, you may have to configure the
If you want to fix the JaCoCo plugin version or tweak the default configuration, you may have to configure the
[JaCoCo Maven Plugin](https://www.eclemma.org/jacoco/trunk/doc/maven.html) in your `pom.xml`, but be aware of the
following:
* do not declare JaCoCo executions for `prepare-agent` and `report` goals as each would run twice during
unit tests (not necessarily with the expected configuration). If you really need to do so anyway, you'll have to
override the `$MAVEN_BUILD_ARGS` variable to remove the explicit invocation to JaCoCo goals.
* make sure the `report` goal computes a CSV report, that is used by the Maven template to compute the global coverage stat.
* make sure the `report` goal computes a CSV report (that's default behavior), that is used by the Maven template to compute the global coverage stat,
* make sure the `report` goal computes an XML report (that's default behavior), that is required to support [GitLab code coverage intergation](https://docs.gitlab.com/ee/ci/testing/test_coverage_visualization/jacoco.html).
More info:
......
......@@ -629,6 +629,9 @@ mvn-build:
reports:
junit:
- "${MAVEN_PROJECT_DIR}/**/target/*-reports/TEST-*.xml"
coverage_report:
coverage_format: jacoco
path: "${MAVEN_PROJECT_DIR}/**/target/site/jacoco/jacoco.xml"
paths:
# version may have been altered
- "${MAVEN_PROJECT_DIR}/**/pom.xml"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment