Domanda

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

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top