Hudson Sonar - Code Coverage not detected when running tests in a sub-module

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Hudson Sonar - Code Coverage not detected when running tests in a sub-module

Doug Beattie
We have a few builds that run unit tests in what the engineers call sub-modules. These sub-modules get run separately and are not part of the production of a jar.
The modules that produce a jar, in a few cases, do not run unit tests.
The Hudson/Sonar reportsĀ  for the modules that build the jars give "Rules compliance" information but under this scenario do not provide "Coverage" information. I simply see 0.0%

Has anyone else dealt with this situation where testing is being done in so called sub-modules and not in the primary module where the jar is produced and you have figured out how to get code "Coverage" statistics in your reports?

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Hudson Sonar - Code Coverage not detected when running tests in a sub-module

Doug Beattie
I found the following googling about this situation:
http://old.nabble.com/Re:-Coverage-in-Sonar-%2B-Multimodule-%2B-Hudson-----p27361975.html

Within this post it says:
--------------------------------------------------------------------------------------------------------------------------
On Wed, Jan 27, 2010 at 9:48 PM, Freddy Mallet <freddy.mallet@...> wrote:
I'm there Frederic ;-)
In fact Sonar can only report code coverage when source code, bytecode and unit tests are in the same module. In all other cases, you'll get a 0% code coverage.
Sorry
Freddy
--------------------------------------------------------------------------------------------------------------------------

Has anything changed regarding obtaining code coverage across modules or will it most likely stay this way that tests must always be withing the module containing the sources?


On Tue, Jun 1, 2010 at 11:11 AM, Doug Beattie <[hidden email]> wrote:
We have a few builds that run unit tests in what the engineers call sub-modules. These sub-modules get run separately and are not part of the production of a jar.
The modules that produce a jar, in a few cases, do not run unit tests.
The Hudson/Sonar reportsĀ  for the modules that build the jars give "Rules compliance" information but under this scenario do not provide "Coverage" information. I simply see 0.0%

Has anyone else dealt with this situation where testing is being done in so called sub-modules and not in the primary module where the jar is produced and you have figured out how to get code "Coverage" statistics in your reports?

Thanks

Reply | Threaded
Open this post in threaded view
|

Re: Hudson Sonar - Code Coverage not detected when running tests in a sub-module

Wim Rosseel
Well I'm not using the sonar plugin as I'm using ant together with ivy to build my projects that are set up with different modules.
As our build scripts foresees in a similar (sub)module setup as maven, but then with ant/ivy I can't use the sonar plugin.
Therefore we add a minimal (sonar light with report reuse) pom.xml to our modules and make sure that proper pom module hierarchy is configured.
Then we just run maven with the sonar target on our projects.
This seems to give us proper component hierarchy in sonar, including the correct coverage statistics on the parent modules even if they themselves don't contain code.

Hope this helps,

greets,

Wim


Nam-tor Ozhika kluterek t'sha'sutenivaya - k'ish she-tor etek s'nezhak - isan utvau vah sha'kakhartayek.


On Tue, Jun 1, 2010 at 8:55 PM, Doug Beattie <[hidden email]> wrote:
I found the following googling about this situation:
http://old.nabble.com/Re:-Coverage-in-Sonar-%2B-Multimodule-%2B-Hudson-----p27361975.html

Within this post it says:
--------------------------------------------------------------------------------------------------------------------------
On Wed, Jan 27, 2010 at 9:48 PM, Freddy Mallet <freddy.mallet@...> wrote:
I'm there Frederic ;-)
In fact Sonar can only report code coverage when source code, bytecode and unit tests are in the same module. In all other cases, you'll get a 0% code coverage.
Sorry
Freddy
--------------------------------------------------------------------------------------------------------------------------

Has anything changed regarding obtaining code coverage across modules or will it most likely stay this way that tests must always be withing the module containing the sources?



On Tue, Jun 1, 2010 at 11:11 AM, Doug Beattie <[hidden email]> wrote:
We have a few builds that run unit tests in what the engineers call sub-modules. These sub-modules get run separately and are not part of the production of a jar.
The modules that produce a jar, in a few cases, do not run unit tests.
The Hudson/Sonar reportsĀ  for the modules that build the jars give "Rules compliance" information but under this scenario do not provide "Coverage" information. I simply see 0.0%

Has anyone else dealt with this situation where testing is being done in so called sub-modules and not in the primary module where the jar is produced and you have figured out how to get code "Coverage" statistics in your reports?

Thanks