Code Coverage on Java Remote VM

旧巷老猫 提交于 2019-12-25 05:05:49

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!