Support coverage for spawned (Java) child processes (Feature request) #100
Description
The desired use case is to collect coverage when JUnit testing a Java 'main' class. Typically, such a 'main' class is tested by spawning it in its own process during the JUnit test. A naive process execution (e.g. exec 'java acme.Main') cannot collect coverage, since it does not load the JaCoCo agent. So, it is understood that at least some JaCoCo argument must be passed in the exec line. However, it is hard to see how that argument can be properly constructed from within the JUnit test. At least the following is unknown/hard to obtain:
- Exact classpath of the jacoco agent
- Port of the Jacoco server
- Sessionid to be used
Ideally, the Emma plugin would make the required JaCoCo argument available as a 'defined' property, e.g. 'jacoco.jvm.arg', available for application during the JUnit test. In this way, child processes can easily be constructed with the appropriate JaCoco configuration argument.
Activity