You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by kf...@uci.edu on 2012/07/01 03:51:26 UTC

Re: Code coverage report for multi module maven project reports zero in some modules

Yes, I have moduleA, moduleB, moduleC, moduleD, moduleE and module F. I
run JUnit tests from module F.

The report in the moduleF/target... directory has the required coverage
information. However, the coverage report in the other modules reports
line and code coverage as zero.

I did try to use the aggregate option with setting it to true, to see an
aggregate coverage report for all modules, it gives the aggregate report,
but again only for packages in moduleF(from where we run JUnit tests) and
reports as zero for all other modules.

I am trying what was suggested in the first response to this question.

Is there a way that we generate the code coverage report for all modules,
with out using ant and only with use of cobertura ?

Thanks

> Aggregated cobertura report will execute cobertura on each module and then
> merge the single reports. It will not help if, for example, you have tests
> in module A and want to have coverage of module B.
>
>
> On Sat, Jun 30, 2012 at 10:46 AM, Patrick Mohr <kc...@gmail.com> wrote:
>
>> On Sat, Jun 30, 2012 at 12:18 AM, Aliaksei Lahachou <
>> aliaksei.lahachou@gmail.com> wrote:
>>
>> > Hi!
>> >
>> > cobertura:cobertura executes it's own lifecycle: instruments the
>> classes,
>> > instrumented classes are saved to target/generated-classes/cobertura,
>> and
>> > executes unit tests. Instrumented classes dump coverage data to
>> > target/conbertura/cobertura.ser. There are two things to understand:
>> >
>> > 1. When cobertura:cobertura is executed, dependencies are not
>> instrumented.
>> > You have to have enabled instrumentation, see cobertura:instrument
>> goal.
>> > This will produce jars with instrumented classes, so be careful not to
>> > distribute them.
>> > 2. Each module will write coverage data to it's own
>> > target/conbertura/cobertura.ser file. I think it's possible to
>> configure
>> > instrumentation so that all jars write to the same cobertura.ser file,
>> but
>> > I don't know whether it's normal, and I never tried that.
>> >
>> >
>> I want to say that there's a cobertura target.  Something like
>> cobertura:aggregate that will combine the results off all the unit
>> tests,
>> for the module that's being tested.  That probably won't be what you
>> want,
>> but I think it would be a lot closer.  This is all from memory though,
>> so
>> make sure to check it's actually what you want.
>>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Code coverage report for multi module maven project reports zero in some modules

Posted by kf...@uci.edu.
Thanks Thomas,

I tried what you suggested and now we have the code coverage report for
all our modules.

Thanks
Khurram

> On 1 July 2012 03:51,  <kf...@uci.edu> wrote:
>> Yes, I have moduleA, moduleB, moduleC, moduleD, moduleE and module F. I
>> run JUnit tests from module F.
>
> This is not the way the Cobertura plugin expects you to do stuff. I
> have solved this scenario with a mix if Maven and And. If you are
> interested, take a look at
> http://thomassundberg.wordpress.com/2012/02/18/test-coverage-in-a-multi-module-maven-project/
>
> HTH
> Thomas
>
>
>
>>
>> The report in the moduleF/target... directory has the required coverage
>> information. However, the coverage report in the other modules reports
>> line and code coverage as zero.
>>
>> I did try to use the aggregate option with setting it to true, to see an
>> aggregate coverage report for all modules, it gives the aggregate
>> report,
>> but again only for packages in moduleF(from where we run JUnit tests)
>> and
>> reports as zero for all other modules.
>>
>> I am trying what was suggested in the first response to this question.
>>
>> Is there a way that we generate the code coverage report for all
>> modules,
>> with out using ant and only with use of cobertura ?
>>
>> Thanks
>>
>>> Aggregated cobertura report will execute cobertura on each module and
>>> then
>>> merge the single reports. It will not help if, for example, you have
>>> tests
>>> in module A and want to have coverage of module B.
>>>
>>>
>>> On Sat, Jun 30, 2012 at 10:46 AM, Patrick Mohr <kc...@gmail.com>
>>> wrote:
>>>
>>>> On Sat, Jun 30, 2012 at 12:18 AM, Aliaksei Lahachou <
>>>> aliaksei.lahachou@gmail.com> wrote:
>>>>
>>>> > Hi!
>>>> >
>>>> > cobertura:cobertura executes it's own lifecycle: instruments the
>>>> classes,
>>>> > instrumented classes are saved to
>>>> target/generated-classes/cobertura,
>>>> and
>>>> > executes unit tests. Instrumented classes dump coverage data to
>>>> > target/conbertura/cobertura.ser. There are two things to understand:
>>>> >
>>>> > 1. When cobertura:cobertura is executed, dependencies are not
>>>> instrumented.
>>>> > You have to have enabled instrumentation, see cobertura:instrument
>>>> goal.
>>>> > This will produce jars with instrumented classes, so be careful not
>>>> to
>>>> > distribute them.
>>>> > 2. Each module will write coverage data to it's own
>>>> > target/conbertura/cobertura.ser file. I think it's possible to
>>>> configure
>>>> > instrumentation so that all jars write to the same cobertura.ser
>>>> file,
>>>> but
>>>> > I don't know whether it's normal, and I never tried that.
>>>> >
>>>> >
>>>> I want to say that there's a cobertura target.  Something like
>>>> cobertura:aggregate that will combine the results off all the unit
>>>> tests,
>>>> for the module that's being tested.  That probably won't be what you
>>>> want,
>>>> but I think it would be a lot closer.  This is all from memory though,
>>>> so
>>>> make sure to check it's actually what you want.
>>>>
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>
>
>
> --
> Thomas Sundberg
> M. Sc. in Computer Science
>
> Mobile: +46 70 767 33 15
> Blog: http://thomassundberg.wordpress.com/
> Twitter: @thomassundberg
>
> Better software through faster feedback
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Code coverage report for multi module maven project reports zero in some modules

Posted by Thomas Sundberg <ts...@kth.se>.
On 1 July 2012 03:51,  <kf...@uci.edu> wrote:
> Yes, I have moduleA, moduleB, moduleC, moduleD, moduleE and module F. I
> run JUnit tests from module F.

This is not the way the Cobertura plugin expects you to do stuff. I
have solved this scenario with a mix if Maven and And. If you are
interested, take a look at
http://thomassundberg.wordpress.com/2012/02/18/test-coverage-in-a-multi-module-maven-project/

HTH
Thomas



>
> The report in the moduleF/target... directory has the required coverage
> information. However, the coverage report in the other modules reports
> line and code coverage as zero.
>
> I did try to use the aggregate option with setting it to true, to see an
> aggregate coverage report for all modules, it gives the aggregate report,
> but again only for packages in moduleF(from where we run JUnit tests) and
> reports as zero for all other modules.
>
> I am trying what was suggested in the first response to this question.
>
> Is there a way that we generate the code coverage report for all modules,
> with out using ant and only with use of cobertura ?
>
> Thanks
>
>> Aggregated cobertura report will execute cobertura on each module and then
>> merge the single reports. It will not help if, for example, you have tests
>> in module A and want to have coverage of module B.
>>
>>
>> On Sat, Jun 30, 2012 at 10:46 AM, Patrick Mohr <kc...@gmail.com> wrote:
>>
>>> On Sat, Jun 30, 2012 at 12:18 AM, Aliaksei Lahachou <
>>> aliaksei.lahachou@gmail.com> wrote:
>>>
>>> > Hi!
>>> >
>>> > cobertura:cobertura executes it's own lifecycle: instruments the
>>> classes,
>>> > instrumented classes are saved to target/generated-classes/cobertura,
>>> and
>>> > executes unit tests. Instrumented classes dump coverage data to
>>> > target/conbertura/cobertura.ser. There are two things to understand:
>>> >
>>> > 1. When cobertura:cobertura is executed, dependencies are not
>>> instrumented.
>>> > You have to have enabled instrumentation, see cobertura:instrument
>>> goal.
>>> > This will produce jars with instrumented classes, so be careful not to
>>> > distribute them.
>>> > 2. Each module will write coverage data to it's own
>>> > target/conbertura/cobertura.ser file. I think it's possible to
>>> configure
>>> > instrumentation so that all jars write to the same cobertura.ser file,
>>> but
>>> > I don't know whether it's normal, and I never tried that.
>>> >
>>> >
>>> I want to say that there's a cobertura target.  Something like
>>> cobertura:aggregate that will combine the results off all the unit
>>> tests,
>>> for the module that's being tested.  That probably won't be what you
>>> want,
>>> but I think it would be a lot closer.  This is all from memory though,
>>> so
>>> make sure to check it's actually what you want.
>>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>



-- 
Thomas Sundberg
M. Sc. in Computer Science

Mobile: +46 70 767 33 15
Blog: http://thomassundberg.wordpress.com/
Twitter: @thomassundberg

Better software through faster feedback

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Code coverage report for multi module maven project reports zero in some modules

Posted by Aliaksei Lahachou <al...@gmail.com>.
I also use jenkins cobertura plugin and it does nothing special. It is
invoked after the build and only generates aggregated report from single
coverage.xml files.


On Sun, Jul 1, 2012 at 9:00 AM, Tim Wu T <ti...@ericsson.com> wrote:

> Hi,
>
> I met the same problem with you, now, I use jenkins cobuertural plugin,
> which will help me generate a whole report, not only include some packages
> :)
>
> Br,
> Tim
>
> -----Original Message-----
> From: kfmohamm@uci.edu [mailto:kfmohamm@uci.edu]
> Sent: Sunday, July 01, 2012 9:51 AM
> To: Maven Users List
> Subject: Re: Code coverage report for multi module maven project reports
> zero in some modules
>
> Yes, I have moduleA, moduleB, moduleC, moduleD, moduleE and module F. I
> run JUnit tests from module F.
>
> The report in the moduleF/target... directory has the required coverage
> information. However, the coverage report in the other modules reports
> line and code coverage as zero.
>
> I did try to use the aggregate option with setting it to true, to see an
> aggregate coverage report for all modules, it gives the aggregate report,
> but again only for packages in moduleF(from where we run JUnit tests) and
> reports as zero for all other modules.
>
> I am trying what was suggested in the first response to this question.
>
> Is there a way that we generate the code coverage report for all modules,
> with out using ant and only with use of cobertura ?
>
> Thanks
>
> > Aggregated cobertura report will execute cobertura on each module and
> then
> > merge the single reports. It will not help if, for example, you have
> tests
> > in module A and want to have coverage of module B.
> >
> >
> > On Sat, Jun 30, 2012 at 10:46 AM, Patrick Mohr <kc...@gmail.com> wrote:
> >
> >> On Sat, Jun 30, 2012 at 12:18 AM, Aliaksei Lahachou <
> >> aliaksei.lahachou@gmail.com> wrote:
> >>
> >> > Hi!
> >> >
> >> > cobertura:cobertura executes it's own lifecycle: instruments the
> >> classes,
> >> > instrumented classes are saved to target/generated-classes/cobertura,
> >> and
> >> > executes unit tests. Instrumented classes dump coverage data to
> >> > target/conbertura/cobertura.ser. There are two things to understand:
> >> >
> >> > 1. When cobertura:cobertura is executed, dependencies are not
> >> instrumented.
> >> > You have to have enabled instrumentation, see cobertura:instrument
> >> goal.
> >> > This will produce jars with instrumented classes, so be careful not to
> >> > distribute them.
> >> > 2. Each module will write coverage data to it's own
> >> > target/conbertura/cobertura.ser file. I think it's possible to
> >> configure
> >> > instrumentation so that all jars write to the same cobertura.ser file,
> >> but
> >> > I don't know whether it's normal, and I never tried that.
> >> >
> >> >
> >> I want to say that there's a cobertura target.  Something like
> >> cobertura:aggregate that will combine the results off all the unit
> >> tests,
> >> for the module that's being tested.  That probably won't be what you
> >> want,
> >> but I think it would be a lot closer.  This is all from memory though,
> >> so
> >> make sure to check it's actually what you want.
> >>
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

RE: Code coverage report for multi module maven project reports zero in some modules

Posted by Tim Wu T <ti...@ericsson.com>.
Hi,

I met the same problem with you, now, I use jenkins cobuertural plugin, which will help me generate a whole report, not only include some packages :)

Br,
Tim

-----Original Message-----
From: kfmohamm@uci.edu [mailto:kfmohamm@uci.edu] 
Sent: Sunday, July 01, 2012 9:51 AM
To: Maven Users List
Subject: Re: Code coverage report for multi module maven project reports zero in some modules

Yes, I have moduleA, moduleB, moduleC, moduleD, moduleE and module F. I
run JUnit tests from module F.

The report in the moduleF/target... directory has the required coverage
information. However, the coverage report in the other modules reports
line and code coverage as zero.

I did try to use the aggregate option with setting it to true, to see an
aggregate coverage report for all modules, it gives the aggregate report,
but again only for packages in moduleF(from where we run JUnit tests) and
reports as zero for all other modules.

I am trying what was suggested in the first response to this question.

Is there a way that we generate the code coverage report for all modules,
with out using ant and only with use of cobertura ?

Thanks

> Aggregated cobertura report will execute cobertura on each module and then
> merge the single reports. It will not help if, for example, you have tests
> in module A and want to have coverage of module B.
>
>
> On Sat, Jun 30, 2012 at 10:46 AM, Patrick Mohr <kc...@gmail.com> wrote:
>
>> On Sat, Jun 30, 2012 at 12:18 AM, Aliaksei Lahachou <
>> aliaksei.lahachou@gmail.com> wrote:
>>
>> > Hi!
>> >
>> > cobertura:cobertura executes it's own lifecycle: instruments the
>> classes,
>> > instrumented classes are saved to target/generated-classes/cobertura,
>> and
>> > executes unit tests. Instrumented classes dump coverage data to
>> > target/conbertura/cobertura.ser. There are two things to understand:
>> >
>> > 1. When cobertura:cobertura is executed, dependencies are not
>> instrumented.
>> > You have to have enabled instrumentation, see cobertura:instrument
>> goal.
>> > This will produce jars with instrumented classes, so be careful not to
>> > distribute them.
>> > 2. Each module will write coverage data to it's own
>> > target/conbertura/cobertura.ser file. I think it's possible to
>> configure
>> > instrumentation so that all jars write to the same cobertura.ser file,
>> but
>> > I don't know whether it's normal, and I never tried that.
>> >
>> >
>> I want to say that there's a cobertura target.  Something like
>> cobertura:aggregate that will combine the results off all the unit
>> tests,
>> for the module that's being tested.  That probably won't be what you
>> want,
>> but I think it would be a lot closer.  This is all from memory though,
>> so
>> make sure to check it's actually what you want.
>>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org