How to turn off code coverage in SonarQube 4? - java

How to turn off code coverage in SonarQube 4? I have JMockit usage in unit tests and JaCoCo code coverage plugin in Sonar. They conflict because they use different javaagents to edit bytecode of classes (as I know). I want to switch off code coverage in Sonar. I can exclude my project in settings of Jacoco, but it doesn't help.

I recommend following the paragraph "Ignore Code Coverage" in this documentation:
http://docs.sonarqube.org/display/SONAR/Narrowing+the+Focus

Related

my sonarqube always said no code coverage for java

hi all i have build unit testing for controller, repository and Service but why in my sonarqube code coverage always give me code coverage only 0 percent. my question is how to make my percentage up ?
here what i was code in my testing
Sonarqube uses existing code coverage reports from JaCoCo (in the case of Java). Usually, you would set up the JaCoCo Maven plugin (or Gradle) to gather coverage info on test run and Sonarqube then loads this report.
See also the Sonarqube docs for info on setup. But if you are using Maven/Gradle, I believe Sonarqube is able to automatically pick up the correct file unless you have some special configuration.

Does Spring boot provide any internal library for generating coverage report

I am working on an assignment in which I need to generate code coverage report without using any plugin.I have gone through the Spring boot documentation but could not find any article on coverage report generation. Is it possible to generate coverage report without using any plugin like jacoco or maven-surefire-report-plugin or sonarQube. Any input will be highly appreciated. Thanks!!
No, It isn't. Spring Boot's maven/gradle plugins does not provide support for code coverage out of the box, you will need to use either JaCoCo or a similar tool.
See:
Generate Code Coverage with JaCoCo and spring-boot-maven-plugin
Code Coverage and Source Quality Analysis with Spring Boot + Docker + SonarQube + JaCoCo

SonarQube calculates wrong code coverage from jacoco result

We have a java project for which we are using jenkins.
In the build part we have configured jacoco as java agent to measure the code coverage.
If I download the created jacoco report and load it to IntelliJ all is fine.
But the sonar scanner also loads it up to the sonar server and there is something wrong with the analysis: Some classes and methods which are covered by tests (and I can see the coverage from the jacoco report in IntelliJ) are reported as uncovered by SonarQube.
Sonar Scanner definitly handles the right jacoco report.
Has anybody any idea where I should look for?
Is there anything in the sonar server which can led to a wrong coverage?
Thanks for any help!

Clover does not detect any tests at all

I'm using Clover in a project, to help get test coverage over 7%.
I separated and renamed unit tests and integration tests into *Test.java and *IT.java, and added Surefire to reduce build times.
All tests run fine.
Now suddenly Clover says test coverage is 0%.
What can be the reason for this, and how do I fix it?
I managed to get it working again by removing Clover and Surefire, and then adding Clover with only simple settings

Code coverage of play 1.2.7 project with jacoco

For my project I get a good coverage report by jacoco for the models, but no coverage is shown to the controllers. Is there any configuration option that needs to be applied to jacoco to cover the static methods in the play framework controllers?
This is the command line to launch the automated tests in play with jacoco:
$ play-1.2.7/play auto-test PWO -javaagent:../jacoco/lib/jacocoagent.jar
There are some problems with Jacoco, if you combine it with Mockito or Powermock. Maybe it is your case as well:
Mockito - https://code.google.com/p/mockito/issues/detail?id=385&q=jacoco
Powermock - more than one issues. See https://code.google.com/p/powermock/issues/list?can=2&q=jacoco&colspec=ID+Type+Status+Priority+Milestone+Owner+Summary&cells=tiles
As far as I think, Jacoco has no problem with static methods or static initializers.

Categories

Resources