Reputation: 352
I have generated coverage reports with cobertura outside of sonar and would like to "reuse" them and import them into Sonar. Is this possible.
Sonar 3.73 Sonar-Runner 2.3
sonar.projectKey=org.me:artifactname
sonar.projectName=Project Name
sonar.projectVersion=1.0
sonar.sources=src/groovy, grails-app
sonar.language=grvy
sonar.sourceEncoding=UTF-8
sonar.tests=test/unit
sonar.dynamicAnalysis=reuseReports
sonar.core.codeCoveragePlugin=cobertura
sonar.cobertura.reportPath=target/test-reports/cobertura/coverage.xml
sonar.surefire.reportsPath=target/test-reports
sonar.grvy.coveragePlugin=cobertura
The coverage.xml file does exist and is in that path. I've checked it 100 times.
The Unit Test success info is filled out in sonar but the Unit Tests Coverage is a dash, and blank.
Everything else is filled in, complexity, lines of code....
Here's part of the output.
15:47:10.837 INFO - Load module settings
15:47:11.085 INFO - Quality profile : [name=Sonar way,language=grvy]
15:47:11.103 INFO - Excluded tests:
15:47:11.104 INFO - **/package-info.java
15:47:11.143 INFO - Configure Maven plugins
15:47:11.176 INFO - Compare to previous analysis (2013-12-20)
15:47:11.210 INFO - Compare over 30 days (2013-11-20, analysis of 2013-12-19 15:41:26.0)
15:47:11.219 INFO - Compare to previous version
15:47:11.648 INFO - Base dir: /Users/Shared/Jenkins/Home/jobs/Grails-Sample-Master/workspace
15:47:11.648 INFO - Working dir: /Users/Shared/Jenkins/Home/jobs/Grails-Sample-Master/workspace/.sonar
15:47:11.648 INFO - Source dirs: /Users/Shared/Jenkins/Home/jobs/Grails-Sample-Master/workspace/src/groovy
15:47:11.648 INFO - Source encoding: UTF-8, default locale: en_US
15:47:11.662 INFO - Sensor GroovySourceImporter...
15:47:11.761 INFO - Sensor GroovySourceImporter done: 99 ms
15:47:11.761 INFO - Sensor CpdSensor...
15:47:11.761 INFO - SonarBridgeEngine is used
15:47:11.763 INFO - Cross-project analysis disabled
15:47:11.840 INFO - Sensor CpdSensor done: 79 ms
15:47:11.841 INFO - Sensor GroovySensor...
15:47:12.855 INFO - GMetrics completed: 591ms
15:47:12.879 INFO - Sensor GroovySensor done: 1038 ms
15:47:12.879 INFO - Sensor Groovy SurefireSensor...
15:47:12.881 INFO - parsing /Users/Shared/Jenkins/Home/jobs/Grails-Sample-Master/workspace/target/test-reports
15:47:12.978 INFO - Sensor Groovy SurefireSensor done: 99 ms
15:47:12.978 INFO - Sensor InitialOpenIssuesSensor...
15:47:12.983 INFO - Sensor InitialOpenIssuesSensor done: 5 ms
15:47:12.983 INFO - Sensor ProfileSensor...
15:47:12.993 INFO - Sensor ProfileSensor done: 10 ms
15:47:12.993 INFO - Sensor ProfileEventsSensor...
15:47:13.019 INFO - Sensor ProfileEventsSensor done: 26 ms
15:47:13.019 INFO - Sensor ProjectLinksSensor...
15:47:13.028 INFO - Sensor ProjectLinksSensor done: 9 ms
15:47:13.029 INFO - Sensor VersionEventsSensor...
15:47:13.041 INFO - Sensor VersionEventsSensor done: 12 ms
15:47:13.041 INFO - Sensor org.sonar.plugins.artifactsize.ArtifactSizeSensor@52156251...
15:47:13.041 INFO - The file null does not exist
15:47:13.041 INFO - Sensor org.sonar.plugins.artifactsize.ArtifactSizeSensor@52156251 done: 0 ms
15:47:13.470 INFO - Execute decorators...
Thoughts.
Upvotes: 4
Views: 8032
Reputation: 45040
You need to use the right property key for specifying the coverage xml report path:
sonar.groovy.cobertura.reportPath=target/test-reports/cobertura/coverage.xml
Upvotes: 0
Reputation: 31
Try using the absolute path for cobetura reportpath properties. For windows box you can try using the below
sonar.cobertura.reportPath=\\target\\test-reports\\cobertura\\coverage.xml
Upvotes: 1
Reputation: 5277
Try adding this block to your BuildConfig.groovy
coverage {
xml = true
}
Upvotes: 0