Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] AspectJ and code coverage?

Hi Wim,
I'm using Maven2 + AspectJ + Cobertura successfully, but there are a few caveats.

I'm currently weaving first and then instrumenting with cobertura. If I remember correctly, I'm cobertura-instrumenting the entire jar. I could do this cause in our setup coverage reports are executed in a separate step, when generating the project site. Since AspectJ inlines a few calls inside methods using "line 1" of the target class file, or the first line of the method, you'll see cobertura reporting a lot of hits on this lines, even if they does not contain any apparently useful code. This may confuse who is used to cobertura reports and not aware of AspectJ internals, but can be interpreted as useful informations cause you may understand how many instructions are executed because of AspectJ aspect lookup.

I also set up a "load time cobertura instrumentation", that goes in pair with load time weaving, but in that case if an entire class does not get loaded, cobertura knows nothing about it, which alters the global coverage measurements, so I dropped it.

If you have a specific error, I can try to investigate it.

Simone



Wim Deblauwe wrote:
Hi,

is there anybody who is using AspectJ with a code coverage tool. We are using Cobertura and Maven2, but that does not work when you start to add an aspect to your code and you need to use the ajc compiler. I just checked with Atlassian and Clover cannot seem to manage it according to them. Anybody knows a workaround? I don't want to have code coverage on the aspect, I just don't want to loose the coverage on my regular java classes.

regards,

Wim
------------------------------------------------------------------------

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


--
Simone Gianni            CEO Semeru s.r.l.           Apache Committer
http://www.simonegianni.it/



Back to the top