I'm doing the code coverage with jacoco plugin . I have multiple projects and I'm able to generate single jacoco.exe but issue is I'm unable to set the threshold value separately for each module . I wanted to set the threshold value for each module.
Here is my jacoco configuration.
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-prepare-agent-integration</id>
<goals>
<goal>prepare-agent-integration</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>default-report-integration</id>
<goals>
<goal>report-integration</goal>
</goals>
</execution>
<execution>
<id>default-check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<haltOnFailure>true</haltOnFailure>
<!-- the build will fail if any rule check fails -->
<!--
* Check configuration used to specify rules on element types (BUNDLE,
* PACKAGE, CLASS, SOURCEFILE or METHOD) with a list of limits. Each limit
* applies to a certain counter (INSTRUCTION, LINE, BRANCH, COMPLEXITY,
* METHOD, CLASS) and defines a minimum or maximum for the corresponding
* value (TOTALCOUNT, COVEREDCOUNT, MISSEDCOUNT, COVEREDRATIO, MISSEDRATIO).
* If a limit refers to a ratio the range is from 0.0 to 1.0 where the
* number of decimal places will also determine the precision in error
* messages. A limit ratio may optionally be declared as a percentage
* where 0.80 and 80% represent the same value, the value must end with %.
-->
<rules>
<rule>
<element>BUNDLE</element>
<!-- <excludes>
<exclude>*Test</exclude>
</excludes>
<limits>
<limit>
<counter>INSTRUCTION</counter>
<value>COVEREDRATIO</value>
<minimum>.95</minimum>
</limit>
<limit>
<counter>BRANCH</counter>
<value>COVEREDRATIO</value>
<minimum>.95</minimum>
</limit>
</limits> -->
</rule>
<rule>
<element>PACKAGE</element>
</rule>
<rule>
<element>CLASS</element>
</rule>
<rule>
<element>SOURCEFILE</element>
</rule>
<rule>
<element>METHOD</element>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
I have multiple projects and I wanted to give the different value for each module.
Please help on this .
Thanks,
Hi Team ,I'm doing the code coverage with jacoco plugin . I have multiple projects and I'm able to generate single jacoco.exe but issue is I'm unable to set the threshold value separately for each module . I wanted to set the threshold value for each module.
I have multiple projects and I wanted to give the different value for each module.
Thanks
Hi Mandrikov ,
Thanks for reply .
Let me give the more information regarding my issue .
I have a separate project called "Code-Coverage" maven project and I have added all project as dependencies and able to generate report and able to do jacoco "check" for single value as "COVEREDRATIO" as "0.95" . but I want to provide COVEREDRATIO value separately for each dependencies .
below are my some dependencies.
<dependency>
<groupId>api.common</groupId>
<artifactId>api-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>api.engine</groupId>
<artifactId>api-engine</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>api.externalAuth</groupId>
<artifactId>api-externalAuth</artifactId>
<version>${project.version}</version>
</dependency>
So I want to give the COVEREDRATIO value independently for each module/Dependency .
Ex : for api-engine --I want to give COVEREDRATIO - 0.95
for api-common -- I want to give COVEREDRATIO --0.8
Thanks
Hi Team ,
Just to provide more information .
Let's take an example .
I have a project A , B ,C and all three having unit test cases and also I have a project called "Integration-tests" where it will perform integration tests for all three modules/projects (A,B,C) . now I have created a project called "Code-coverage " in tha I'm able to generate aggregate report by merging all jacococ.exec's generated in individual projects. Now I want to perform Jacoco "check" with threshold values per module (let's say for A : 0.9 , B:0.8 , C:0.7) in "Code-coverage" project but not in individual project .
Thanks,