How to get code coverage per test with sonar and ant?

594 views
Skip to first unread message

christia...@gmail.com

unread,
Nov 29, 2017, 10:58:30 AM11/29/17
to SonarQube
Hi everybody,

we are currently using sonar for static code analysis with ant. We get the general code coverage for the whole project and the list from all unit tests in sonar, but not for for each unit test.
We get the following message during sonar target run:
INFO  - No information about coverage per test.

We generate the junit xml files and the Jacoco.exec files and sonar scanner also find it, but the generation of individual test reports seems not to be possible. Here is the full output:
06:24:48 [sonar:sonar] 06:24:48.346 INFO  - Sensor SurefireSensor [java]
06:24:48 [sonar:sonar] 06:24:48.350 INFO  - parsing [/var/lib/jenkins/workspace/job/log/junit]
06:24:58 [sonar:sonar] 06:24:58.733 INFO  - Sensor SurefireSensor [java] (done) | time=10387ms
06:24:58 [sonar:sonar] 06:24:58.733 INFO  - Sensor JaCoCoSensor [java]
06:25:01 [sonar:sonar] 06:25:01.530 INFO  - Analysing /var/lib/jenkins/workspace/job/log/junit/jacoco.exec
06:25:10 [sonar:sonar] 06:25:10.845 INFO - No information about coverage per test. 06:25:10 [sonar:sonar] 06:25:10.845 INFO - Sensor JaCoCoSensor [java] (done) | time=12112ms
This is our configuration:
# Following parameters will be set by pipeline job Sonar
sonar.projectVersion=1.2_48-SNAPSHOT
sonar.tests=web/testsrc/com
sonar.sources=web/src/com
sonar.extension=test
sonar.projectName=test
sonar.projectKey=test

sonar.working.directory=.sonar
sonar.dynamicAnalysis=reuseReports
sonar.java.coveragePlugin=jacoco
sonar.junit.reportPaths=../../log/junit
sonar.jacoco.reportPaths=../../log/junit/jacoco.exec
sonar.host.url=https://<host>/sonar
sonar.login=<user>
sonar.password=<passwd>

Do you have any idea why this is not working properly?

Kind regards,
ka51m1r

christia...@gmail.com

unread,
Dec 6, 2017, 2:19:08 AM12/6/17
to SonarQube
Does anybody has an idea?

G. Ann Campbell

unread,
Dec 6, 2017, 3:04:58 PM12/6/17
to SonarQube
Hi,

It's not clear to me from your initial email what you're after. Also, the lack of version numbers makes diagnosing the situation challenging.

Are you trying to understand exactly what's covered by each unit test?


Ann
Reply all
Reply to author
Forward
0 new messages