问题
How can I get (if it is even possible) the code coverage report running on a remote JAVA VM in Eclipse
So I have a Unit test Suite running over the clients (for simplicity VM1) of the service layer (VM2). (The project was already setup this way and it is too deep in to re-architect that part)
Debug works if i add a port listener as follows:
<jvmFlag>-Xdebug</jvmFlag>
<jvmFlag>-Xrunjdwp:transport=dt_socket,address=1044,server=y,suspend=y</jvmFlag>
So was hoping to do something similar for a code coverage tool like EclEmma.
The backend services architecture looks a lot like this: https://github.com/GoogleCloudPlatform/appengine-modules-sample-java
I am suspecting would need to be adding some kind of hook on my service layer as well. (maybe in the parent maven file)
回答1:
You can start JaCoCo (code coverage engine behind Eclipse EclEmma plugin) in a "tcpserver" mode - see option "output" at page http://www.jacoco.org/jacoco/trunk/doc/agent.html
And connect to it
- from EclEmma - http://www.eclemma.org/userdoc/importexport.html
- Ant Task - http://www.jacoco.org/jacoco/trunk/doc/ant.html
- Maven - http://www.jacoco.org/jacoco/trunk/doc/dump-mojo.html
来源:https://stackoverflow.com/questions/43821402/code-coverage-on-java-remote-vm