Hi Joost,

I don't think there is a out of the box solution available. But what you can do today is to limit the scope of the where code coverage is collected for with the 'includes' option of the agent. Unfortunatelly this option stays valid for the the whole life cycle of the JVM. So you would need to start a separate process for every test case.

We do something similar in the JaCoCoC build itself, but on module granilarity: With the includes option we restict the test scope the the module under test only. So unit tests from org.jacoco.report do not contribute coverage to org.jacoco.core.

One solution to your idea would be to use a specialized JUnit test runner which controls code coverage collection through JaCoCo's agent API (http://www.eclemma.org/jacoco/trunk/doc/api/org/jacoco/agent/rt/package-summary.html). This test runner could store coverage for the class under test only and then reset coverage data.

Cheers,
-marc


On 15.01.14 23:03, Joost Cassee wrote:
Hi,

Has anyone had the idea of only counting coverage on the class currently under test? Of course, this would only apply to unit tests, but I am not convinced on coverage on integration tests.

It has always bothered me that related code that is not under test but is called during testing is "rewarded' for being on the path of another test. It would be useful, I think, to be able annotate a test class with the class under test, and have only the coverage on that class be counted.

Is this something that has been done before?

Regards,
Joost
--
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/groups/opt_out.


--
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/groups/opt_out.

Reply via email to