SONAR code coverage including both UT and IT tests

We have a multimodule project which has 4 module
All IntegrationTest cases are written in a separate module which has no source code only src/test/java folder.
All UnitTest are written in other 2 module inside src/test/java
4th module has responsibility to aggregate the report from all 3 module (2 modules that have Unit test and one module that has integration test)
Currently we are getting coverage from UnitTest only We want to include coverage from Integration test as well
SonarQube Version: * Community Edition* v10.6 (92116)
Jacoco Version:0.8.11
We are using following plugin for Unit test

org.jacoco jacoco-maven-plugin 0.8.11 prepare-agent prepare-agent For Unit test we are using surefire plugin 3.0.0-M5

For Integration test we are fail-safe plugin 2.22.2

org.jacoco jacoco-maven-plugin 0.8.11 prepare-agent-integration prepare-agent-integration

Aggregator module plugin

org.jacoco
jacoco-maven-plugin
${jacoco.version}


report-aggregate
verify

report-aggregate



We are able to see three files
2 files from Unit test jacoco.exec
1 file from jacoco-it.exec from integration test module
Aggregator is aggregating all three exec but somehow we are not able to see code coverage from Integration module.
Even if we remove jacoco-it.exec there is no change in code coverage percentage.
We also tried importing jacoco-it.exec in IntellijIdea editor but it show no coverage.
Following are the maven logs:

[INFO] jacoco:0.8.11:report-aggregate (report-aggregate) @ jacoco-aggregate-report

[INFO] Loading execution data file /Users/xyz/Documents/GitHub/geoff/target/jacoco.exec

[INFO] Loading execution data file /Users/xyz/Documents/GitHub/service/target/jacoco.exec

[INFO] Loading execution data file /Users/xyz/Documents/GitHub/integration-test/target/jacoco-it.exec

I am facing the same issue. Can someone please help on this

1 Like

I am also facing this issue. Can someone please help on this

1 Like