Hi Marko,

I think this should be possible. Just make sure that the classes generated by the AspectJ compiler are used at runtime as well as for JaCoCo report generation.

Best regards,
-marc


On 2014-10-23 05:44, [email protected] wrote:
Hi all,

I've seen similar posts before, but none really answers my concerns.
My goal is to measure code coverage with JaCoCo in an AspectJ project.
As described below, I have three dependent projects and I want to
measure code coverage in one particular project.

I have a project A, which depends on a project B. Project B is the
main target project. Project A just acts like a wrapper around project
B. Both are AspectJ projects. I can easily compile them with the
AspectJ compiler. Project A has aspects that affect both project A's
and project B's code.

Then I have a project C, which in an automatic fashion generates JUnit
tests for project B. The tests make calls into project A, which in
turn make calls into B. Because my aspects from project A serve as
monitors watching a code execution starting from the tests, I compile
project C with the AspectJ compiler as well.

My goal is to measure code coverage in project B by exercising the
tests from project C. It all worked fine when all the projects were
"plain" Java projects. However, when I added monitors and turned the
projects into AspectJ projects, I got lost and can't get a code
coverage report with a non-zero coverage. I tried with offline
instrumentation and I see that project B's code gets woven by AspectJ
and instrumented by JaCoCo, but I am not sure JaCoCo can handle this
properly.

My question is: is it even possible to do something like this? If it
is, how to go about it?

If it matters, the way I do it now is to have projects A and B
compiled with the AspectJ compiler, then I generate tests in project
C, compile the tests with the compiler, and do JaCoCo instrumentation
in the end.

All the projects are compiled as source 1.7 and target 1.7. I use
AspectJ 1.8.2 and JaCoCo 0.7.2.


Cheers,
Marko Dimjašević
http://dimjasevic.net/marko

--
You received this message because you are subscribed to the Google Groups "JaCoCo 
and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to