0

I am calling Sonar from my Jenkins job I noticed that the coverage of the classes in my domain module all show as having 0% test coverage even though the domains are being used in the other modules which have high test coverage. I am using cobertura within Sonar for measuring the coverage

Can anyone offer any insights into how to get Sonar/Cobertura to recognise the test coverage for the classes in the domain module

Thanks Damien

Damien
  • 4,081
  • 12
  • 75
  • 126
  • Did you set the appropriate Sonar properties for reusing your code coverage reports as described in this [post](http://stackoverflow.com/questions/11049123/sonar-importing-cobertura-ser-coverage-reports-to-sonar-server-using-mvn-sonars)? – Benjamin Muschko Apr 01 '13 at 16:00

1 Answers1

1

By default, Sonar computes unit test coverage. So if your domain classes are not unit-tested in the module where they are defined, this is normal that you don't get unit test coverage for those.

You can have a look at how to add integration test coverage in Sonar: see https://github.com/SonarSource/sonar-examples/tree/master/projects/code-coverage/combined%20ut-it/combined-ut-it-multimodule-maven-jacoco

But that'd be best to have "real" unit tests for your domain classes to test their logic in an isolated context.

Edit
Link to sonar-exmaple-multiple-modules

change
  • 3,400
  • 7
  • 32
  • 42
  • thanks Fabrice, that makes sense.. I will look at the link you provided and integrate it with our code base. thanks for your help – Damien Apr 02 '13 at 10:37