5

I am running eclemma as well as for measuring the test coverage in my project. I noticed a weird thing,that I am able to get correct results with the help of Eclemma but the results from sonar are different and it is not covering some of the code which expect to be covered by the test cases I have written.

Why do results from both the tools differ?

Rajeev Akotkar
  • 1,377
  • 4
  • 26
  • 46
  • 1
    What is your sonar configuration? Do you use JaCoCo as well in sonar? How do you build your projects? Have you made sure all tests are acually executed during sonar coverage measurement? Sonar may also use a different coverage tool - cobetura for example. – SpaceTrucker May 19 '16 at 12:12

2 Answers2

0

Out-of-the box Sonar supports Jacoco (embedded into lastest versions of eclEmma) and Cobertura engine to report code coverage by unit tests just like eclEmma. So normally they should output the same results. My guess is that you dont have a correct configuration in your Sonar configuration and some tests dont run so it would be nice if you paste it so that we can have a look.

Alexius DIAKOGIANNIS
  • 2,465
  • 2
  • 21
  • 32
0

The coverage metric computed and displayed in SonarQube interface also takes uncovered branches into account. That is why if you look only at uncovered lines in Eclemma you get a different result.

benzonico
  • 10,635
  • 5
  • 42
  • 50