Unable to get integration test data (jacoco) to apply in Sonar

55 views
Skip to first unread message

an...@thepluginpeople.com

unread,
Dec 15, 2017, 5:18:34 AM12/15/17
to SonarQube
Hi all,
I'm having trouble getting IT test data to get published in Sonar, hoping someone has been through this!

I have a maven build that uses jacoco to publish UT coverage data (in target/jacaco.exec ) to Sonar and reports coverage - this works, resulting a X% coverage.  The build also runs IT and generates IT coverage data (in target/jacaco-it.exec), but this doesn't seem to affect the baseline UT data that is uploaded and shown, log excerpt:

[INFO] Sensor SurefireSensor [java] (done) | time=111ms
[INFO] Sensor JaCoCoSensor [java]
[INFO] Analysing /home/andy/workspace/project/target/jacoco.exec
[INFO] Analysing /home/andy/workspace/project/target/jacoco-it.exec
[INFO] Analysing /home/andy/workspace/project/jemh-ui/target/sonar/jacoco-merged.exec
[INFO] No information about coverage per test.
...

The Sonar Project's JaCoCo settings are the defaults 'target/jacoco.exec, target/jacoco-it.exec'.

The Task Report linked in the build ( http://sonar:9000/api/ce/task?id=xxx ) shows a status of SUCCESS with logs FALSE.

Build properties:
     <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
     <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.scm.provider>hg</sonar.scm.provider>

Build plugins:
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>5.1</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.9</version>
</plugin>

Cmd to build /deploy:

mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install
mvn sonar:sonar

Is there a way to diagnose the publication of IT data to sonar, to understand why the IT component is not seeming resulting in an update of coverage in Sonar?

Any insight on this appreciated!
Andy
 

an...@thepluginpeople.com

unread,
Dec 15, 2017, 6:23:58 AM12/15/17
to SonarQube
I also get the same result with the following published example (the parent project, and individually, the app-it project) using the mvn targets above.  We're using Sonar 6.6 here.

G. Ann Campbell

unread,
Jan 2, 2018, 12:19:16 PM1/2/18
to SonarQube
Hi Andy,

You don't mentions versions, so I'll assume the latest & tell you that the properties you're using don't work anymore. Take a look at the docs on how to pass this in: https://docs.sonarqube.org/display/PLUG/Code+Coverage+by+Unit+Tests+for+Java+Project.


Ann
Reply all
Reply to author
Forward
0 new messages