On Friday, January 12, 2018 at 12:57:36 PM UTC+1, [email protected] 
wrote:
>
> I hope someone can help me patch the gaps in my knowledge there!
>


Yes - you can remotely get execution data from JaCoCo agent attached to JVM 
under test.

Agent as described at http://www.jacoco.org/jacoco/trunk/doc/agent.html has 
option "output":

   - file: At VM termination execution data is written to the file 
   specified in the destfile attribute.
   - tcpserver: The agent listens for incoming connections on the TCP port 
   specified by the address and port attribute. Execution data is written to 
   this TCP connection.
   - tcpclient: At startup the agent connects to the TCP port specified by 
   the address and port attribute. Execution data is written to this TCP 
   connection.
   
and option "jmx":

   - If set to true the agent exposes functionality via JMX
   
Agent can be configured with help of Ant Tasks or Maven Plugin or even 
without them.

Exposed via JMX functionality as described in JavaDoc 
( http://www.jacoco.org/jacoco/trunk/doc/api/org/jacoco/agent/rt/IAgent.html 
) among others provides three following methods:

   - byte[] getExecutionData(boolean reset) Returns current execution data.
   - void dump(boolean reset) Triggers a dump of the current execution data 
   through the configured output.
   - void reset() Resets all coverage information.
   
Again from documentation there is also Ant Task "dump" - 
http://www.jacoco.org/jacoco/trunk/doc/ant.html:
This task allows to remotely collect execution data from another JVM 
without stopping it. Remote dumps are useful for long running Java 
processes like application servers.

"dump" command in Command Line Interface - 
http://www.jacoco.org/jacoco/trunk/doc/cli.html
"dump" goal in jacoco-maven-plugin - 
http://www.jacoco.org/jacoco/trunk/doc/dump-mojo.html

API usage examples ( http://www.jacoco.org/jacoco/trunk/doc/api.html ) 
include:

   - MBeanClient.java This example connects to a coverage agent to collect 
   execution data over the JMX.
   - ExecutionDataClient.java This example connects to a coverage agent to 
   collect execution data over the remote protocol.
   - ExecutionDataServer.java This example starts a socket server to 
   collect execution data from agents over the remote protocol.
   
Please note that generation of report in addition to execution data 
requires *exactly the same class files* as in JVM under tests.

The way how you and your teams will use all this is entirely up to you.

-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/87d1ebae-f535-487d-9ee4-8a096f7d5ffc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to