Not able to generate proper code coverage for android/gradle/java/jacoco/sonar

480 views
Skip to first unread message

Rishi Goel

unread,
Mar 8, 2017, 6:25:31 PM3/8/17
to SonarQube
Getting the following in the log file "INFO - No information about coverage per test"

Apart from this I get A LOT of: "DEBUG - Class not found in resource cache" and "WARN - Class not found" statements in the log file.

I am using the following versions:
SonarQube Plugin version 2.01 in build.gradle
Gradle version 3.3.1
I have two SonarQube Servers: One with version 5.1.2 + Java plugin version 3.14 and second with version 5.6.5 + Java plugin version 4.4. Seeing same behavior on both.

Please suggest

Rishi Goel

unread,
Mar 8, 2017, 6:31:57 PM3/8/17
to SonarQube
I get this on the sonar server:

Unit Tests Coverage0.2%
Line Coverage0.2%
Condition Coverage0.2%
 
Unit Test Success100.0%
Failures0
 
Errors0
 
Tests1,083
Skipped13
 
Execution Time1:40 min



I am sure we have A LOT more code coverage than this.

Nicolas Peru

unread,
Mar 9, 2017, 2:41:22 AM3/9/17
to Rishi Goel, SonarQube
Hi, 

Are you generating a code coverage file ?  with which tool? 
You may also want to share the full log of your analysis in order for anyone to be able to help you out.

Cheers, 

--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/b5f69983-bcb1-4e8a-ab61-1b88b1b6b1ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Nicolas PERU | SonarSource
Senior Developer
http://sonarsource.com

Nicolas Peru

unread,
Mar 9, 2017, 9:50:23 AM3/9/17
to Rishi Goel, SonarQube
Hi, 

From what can be seen from the log you sent me privately the jacoco report is generated and properly picked by the analyzer. Therefore it might either be empty or the .class files of your project are not provided to the analyzer properly and the analysis of the report can't figure out which class corresponds to which source file. 

HTH, 

Cheers, 

Rishi Goel

unread,
Mar 9, 2017, 10:52:18 AM3/9/17
to SonarQube, rg.ris...@gmail.com
Hi,

Here's how our folder structure looks after the unit tests are executed and here are the sonar properties we have in the build.gradle file. Are there any inconsistencies?


        property 'sonar.projectName', 'Android - ' + rootProject.name
        property 'sonar.projectVersion', apkVersionName
        properties['sonar.sources'] = android.sourceSets.main.java.srcDirs
        properties['sonar.tests'] = android.sourceSets.test.java.srcDirs
        properties['sonar.java.binaries'] = file('build/intermediates/classes/arm7/debug/')
        properties['sonar.java.test.binaries'] = file('build/intermediates/classes/test/arm7/debug/')

        property 'sonar.junit.reportsPath','build/test-results/testArm7DebugUnitTest/'
        property 'sonar.dynamicAnalysis', 'reuseReports'
        property 'sonar.java.coveragePlugin', 'jacoco'
        property 'sonar.jacoco.reportPath', 'build/jacoco/testArm7DebugUnitTest.exec'

Thanks
Rishi Goel

Rishi Goel

unread,
Mar 9, 2017, 10:53:39 AM3/9/17
to SonarQube, rg.ris...@gmail.com
Btw, the testArm7DebugUnitTest.exec file is only 49KB. So may be it's empty?

Rishi Goel

unread,
Mar 10, 2017, 9:06:59 AM3/10/17
to SonarQube, rg.ris...@gmail.com
Folks, please suggest. We are deep down in waters so would really appreciate some help. Thanks.
Reply all
Reply to author
Forward
0 new messages