Code coverage won't display in Sonarqbue when posting trhough sonar scanner - sonarqube

Sonarqube server 6.7.7
Sonar scanner 4.6.2
sonar-project.properties
sonar.java.binaries=target/classes
#sonar.junit.reportsPath=target/surefire-reports
#sonar.surefire.reportsPath=target/surefire-reports
#sonar.jacoco.reportPaths=target/jacoco.exec
sonar.coverage.jacoco.xmlReportPaths=/target/site/jacoco/jacoco.xml
sonar.java.coveragePlugin=jacoco
sonar.verbose=true
Note: I used the jacoco.xml or the jacoco.exec still not able to display
sonarqube dashboard showing no code coverage

Related

Code coverage published to Sonar is not correct

We're using Sonar Server 9.1 and using maven command to publish reports to Sonar along with code coverage generated through Jacoco
In index.html file generated for code coverage, we can see code coverage as - 68% but used jacoco.xml file to publish to Sonar it's showing only 48.6% code coverages.
What analysis I should do to find the cause of discrepancy?

Reporting coverage to sonarqube configured with cobertura from gradle

My sonarqube server version 8.3.1 has the cobertura plugin enabled for showing cobertura coverage reports. Now I want to report jacoco XML-coverage data (generated with gradle jacoco plugin) and its not working. Are there any known issues between cobertura and jacoco? Or should both mechanisms work on one sonarqube?
Just for someone running in this problem. The problem was that the plugin for importing jacoco xml files has been removed. If you use sonarqube its normally included. So if you can't see the coverage report check that the jacoco plugin has been installed.

Publishing Karma result in sonar

I'm trying to publish karma report in sonar.Ours is a angularJS application Maven project.Already sonarqube is displaying junit code coverage.I have generated lcov.info file but sonarqube is not picking up the file.I have included following properties in sonar but its not working
sonar.javascript.jstestdriver.reportsPath=reports/
sonar.javascript.lcov.reportPath=src/main/webapp/coverage/lcov.info
Any help is appreciated.

After upgrade to SonarQube 5.3 Cobertura test coverage is missing

I recently upgraded to SonarQube 5.3 and now test coverage using Cobertura is no longer published/analyzed.
It looks like JaCoCo is default code coverage no matter what we install or configure. Log shows that SonarQube is looking and not finding JaCoCo reports.
Is there still support for Cobertura with 5.3?
I tried to configure cobertura but sonar.java.coveragePlugin does not seem to do much anymore. You can specify what you like using this property but the JaCoCo will be used.
[INFO] JaCoCoSensor: JaCoCo report not found : E:\myproject\jacoco.exec
[INFO] JaCoCoItSensor: JaCoCo IT report not found: E:\myproject\jacoco-it.exec
Since SonarQube 4.2 the test report isn’t generated by SonarQube anymore (see SonarQube blog post for more information). So you have to do it by your own before you run the sonar analyze. For Maven builds, I wrote a sample how to integrate JaCoCo test reporting generation into a Maven build.
For Cobertura, you have to install the Cobertura Plugin for SonarQube. On that site it is explained how to generate the reports.

coverage.xml not generated even though build successful in jenkins and cobertura instrumentation was successful

I am using Maven with jenkins and sonar to build src and generate reports on Sonar.
I see build was successful in Jenkins (sonar added as post build action) but fails to create coverage.xml in local system. Due to which code coverage is unavailable in Sonar, it just shows up -(empty). I am building a project which has around 4000+ java source files and corresponding JUnit classes.
I am using cobertura-maven-plugin 2.5.1 in pom.xml and I could see this plugin instrumentation was successful while building the code.
In logs I could see that, Cobertura report not found at //coverage.xml message.
Could you please help me on this regard.
coverage.xml was not generated due to OutOfMemeryError:heapspace. Since my project is such a big project when I set heap memory to 2GB and cobertura plugin memory to 1.5GB sonar gets code coverage displayed.
Heap memory set with Jenkins post build action sonar configuration.
Cobertura memory can be configured either in Sonar settings or in your pom.xml.

Resources