You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Mitch Gitman <mg...@gmail.com> on 2009/05/12 20:31:10 UTC

cobertura-instrument--anyone seen this?

I'm not sure there's a better forum for this question. I'm invoking
the *cobertura-instrument
*Ant task for instrumenting classes for Cobertura code coverage. Very
simplistic implementation:
    <cobertura:cobertura-instrument todir="${instrumented.classes.dir}">
      <ignore regex="org.apache.log4j.*" />
      <fileset dir="${main.classes.dir}">
        <include name="**/*.class" />
      </fileset>
    </cobertura:cobertura-instrument>

The output I get though is this:
[cobertura:cobertura-instrument] Cobertura 1.9.1 - GNU GPL License (NO
WARRANTY) - See COPYRIGHT file
[cobertura:cobertura-instrument] Instrumenting 5 files to
C:\...\dist\instrumented
[cobertura:cobertura-instrument] Cobertura: *Saved information on 0 classes.
*
[cobertura:cobertura-instrument] Instrument time: 50ms

The *cobertura-instrument *task did find five files to instrument but it
ends up saving information on 0 classes. Sure enough, if I look in the
directory indicated by the instrumented.classes.dir property, it's empty.

Anyone know why *cobertura-instrument *is missing my .class files? And when
I run it in -verbose mode, it does say it's adding the expected .class
files.

Re: cobertura-instrument--anyone seen this?

Posted by Mitch Gitman <mg...@gmail.com>.
OK, here's the explanation, and well, if it isn't frustrating...

I'd recently rearranged my classpath. (I should have realized right away
that's what changed recently and started down that route.) Apparently, I
wasn't making available in the classpath the libraries needed by Cobertura:
log4j, asm, asm-tree, oro.

I'm using Cobertura 1.9.1. The cobertura-instrument task for that version of
Cobertura doesn't complain or give any kind of indication that those
libraries are missing from the classpath. It just silently succeeds, saying
it saved information on 0 classes. This is true even in verbose mode.

I checked if Cobertura 1.8 behaved differently. Sure enough, it started
spewing out ClassNotFoundExceptions.

On Tue, May 12, 2009 at 2:06 PM, Mitch Gitman <mg...@gmail.com> wrote:

> Thanks, Francis. Actually, just after I posted this query, I thought, "I
> bet the javac debug attribute was inadvertently turned off." Oddly enough,
> though, I'm running with debug="true".
>
> I'll continue to try to isolate what's going on here. I'll send a follow-up
> eventually when I figure it out.
>
>
> On Tue, May 12, 2009 at 11:49 AM, Francis Galiegue <fg...@one2team.com>wrote:
>
>> Le Tuesday 12 May 2009 20:31:10 Mitch Gitman, vous avez écrit :
>> > I'm not sure there's a better forum for this question. I'm invoking
>> > the *cobertura-instrument
>> > *Ant task for instrumenting classes for Cobertura code coverage. Very
>> > simplistic implementation:
>> >     <cobertura:cobertura-instrument todir="${instrumented.classes.dir}">
>> >       <ignore regex="org.apache.log4j.*" />
>> >       <fileset dir="${main.classes.dir}">
>> >         <include name="**/*.class" />
>> >       </fileset>
>> >     </cobertura:cobertura-instrument>
>> >
>> > The output I get though is this:
>> > [cobertura:cobertura-instrument] Cobertura 1.9.1 - GNU GPL License (NO
>> > WARRANTY) - See COPYRIGHT file
>> > [cobertura:cobertura-instrument] Instrumenting 5 files to
>> > C:\...\dist\instrumented
>> > [cobertura:cobertura-instrument] Cobertura: *Saved information on 0
>> > classes. *
>> > [cobertura:cobertura-instrument] Instrument time: 50ms
>> >
>> > The *cobertura-instrument *task did find five files to instrument but it
>> > ends up saving information on 0 classes. Sure enough, if I look in the
>> > directory indicated by the instrumented.classes.dir property, it's
>> empty.
>> >
>> > Anyone know why *cobertura-instrument *is missing my .class files? And
>> when
>> > I run it in -verbose mode, it does say it's adding the expected .class
>> > files.
>>
>> From my experience (I use emma, not cobertura), the coverage is very
>> dependent
>> from the way your classes are compiled. Do you have debug="true" in your
>> javac task?
>>
>> --
>> Francis Galiegue
>> fge@one2team.com
>> Ingénieur système
>> Mob : +33 (0) 683 877 875
>> Tel : +33 (0) 178 945 552
>> One2team
>> 40 avenue Raymond Poincaré
>> 75116 Paris
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>

Re: cobertura-instrument--anyone seen this?

Posted by Mitch Gitman <mg...@gmail.com>.
Thanks, Francis. Actually, just after I posted this query, I thought, "I bet
the javac debug attribute was inadvertently turned off." Oddly enough,
though, I'm running with debug="true".

I'll continue to try to isolate what's going on here. I'll send a follow-up
eventually when I figure it out.

On Tue, May 12, 2009 at 11:49 AM, Francis Galiegue <fg...@one2team.com> wrote:

> Le Tuesday 12 May 2009 20:31:10 Mitch Gitman, vous avez écrit :
> > I'm not sure there's a better forum for this question. I'm invoking
> > the *cobertura-instrument
> > *Ant task for instrumenting classes for Cobertura code coverage. Very
> > simplistic implementation:
> >     <cobertura:cobertura-instrument todir="${instrumented.classes.dir}">
> >       <ignore regex="org.apache.log4j.*" />
> >       <fileset dir="${main.classes.dir}">
> >         <include name="**/*.class" />
> >       </fileset>
> >     </cobertura:cobertura-instrument>
> >
> > The output I get though is this:
> > [cobertura:cobertura-instrument] Cobertura 1.9.1 - GNU GPL License (NO
> > WARRANTY) - See COPYRIGHT file
> > [cobertura:cobertura-instrument] Instrumenting 5 files to
> > C:\...\dist\instrumented
> > [cobertura:cobertura-instrument] Cobertura: *Saved information on 0
> > classes. *
> > [cobertura:cobertura-instrument] Instrument time: 50ms
> >
> > The *cobertura-instrument *task did find five files to instrument but it
> > ends up saving information on 0 classes. Sure enough, if I look in the
> > directory indicated by the instrumented.classes.dir property, it's empty.
> >
> > Anyone know why *cobertura-instrument *is missing my .class files? And
> when
> > I run it in -verbose mode, it does say it's adding the expected .class
> > files.
>
> From my experience (I use emma, not cobertura), the coverage is very
> dependent
> from the way your classes are compiled. Do you have debug="true" in your
> javac task?
>
> --
> Francis Galiegue
> fge@one2team.com
> Ingénieur système
> Mob : +33 (0) 683 877 875
> Tel : +33 (0) 178 945 552
> One2team
> 40 avenue Raymond Poincaré
> 75116 Paris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Re: cobertura-instrument--anyone seen this?

Posted by Francis Galiegue <fg...@one2team.com>.
Le Tuesday 12 May 2009 20:31:10 Mitch Gitman, vous avez écrit :
> I'm not sure there's a better forum for this question. I'm invoking
> the *cobertura-instrument
> *Ant task for instrumenting classes for Cobertura code coverage. Very
> simplistic implementation:
>     <cobertura:cobertura-instrument todir="${instrumented.classes.dir}">
>       <ignore regex="org.apache.log4j.*" />
>       <fileset dir="${main.classes.dir}">
>         <include name="**/*.class" />
>       </fileset>
>     </cobertura:cobertura-instrument>
>
> The output I get though is this:
> [cobertura:cobertura-instrument] Cobertura 1.9.1 - GNU GPL License (NO
> WARRANTY) - See COPYRIGHT file
> [cobertura:cobertura-instrument] Instrumenting 5 files to
> C:\...\dist\instrumented
> [cobertura:cobertura-instrument] Cobertura: *Saved information on 0
> classes. *
> [cobertura:cobertura-instrument] Instrument time: 50ms
>
> The *cobertura-instrument *task did find five files to instrument but it
> ends up saving information on 0 classes. Sure enough, if I look in the
> directory indicated by the instrumented.classes.dir property, it's empty.
>
> Anyone know why *cobertura-instrument *is missing my .class files? And when
> I run it in -verbose mode, it does say it's adding the expected .class
> files.

From my experience (I use emma, not cobertura), the coverage is very dependent 
from the way your classes are compiled. Do you have debug="true" in your 
javac task?

-- 
Francis Galiegue
fge@one2team.com
Ingénieur système
Mob : +33 (0) 683 877 875
Tel : +33 (0) 178 945 552
One2team
40 avenue Raymond Poincaré
75116 Paris

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org