Skip to main content

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

Title: Problem with using cobertura to calculate unit test coverage for projects using AspectJ

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


Back to the top