Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Problem with using cobertura to calculate unit test coverage for projects using AspectJ

Not being familiar with cobertura, I can't know for certain what is
going on, but here is a possibility.

AspectJ generates extra methods and extra classes (for using around
advice).  If Cobertura is instrumenting byte code before AspectJ
weaver generates its byte code, then there may be extra places that
should be instrumented but are not.

Perhaps having cobertura instrument after aspectj finishes its weaving
could solve this.

--a

On Wed, Apr 15, 2009 at 9:12 PM, Rakesh Arora <rakesh.arora@xxxxxxxxxx> wrote:
> In our project we are using AspectJ only for unit testing. So we are using
> test-compile goal of aspectj-maven-plugin:
> http://mojo.codehaus.org/aspectj-maven-plugin/
>
> We also use cobertura maven plugin to calculate the unit test coverage
> http://mojo.codehaus.org/cobertura-maven-plugin/
>
> Cobertura is not reporting the test coverage correctly. It doesn't include
> the source code files that has been weaved by aspectj compiler for unit test
> coverage.
>
> Here is what happens during the build:
>
> Cobertura instruments the java classes in target/generated-sources/cobertura
> aspectj:test-compile weaves the classes from src/main/java and src/main/test
> into target/test-classes.
>
> So Cobertura enhanced files are not seen during the test run.
>
> Any idea how to fix this? Is there any other way to calculate the unit test
> coverage in this scenario?
>
> Thanks,
> -Rakesh
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>


Back to the top