Java远程VM上的代码覆盖率 [英] Code Coverage on Java Remote VM

查看:85
本文介绍了Java远程VM上的代码覆盖率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取(甚至可能)在Eclipse中的远程JAVA VM上运行的代码覆盖率报告

How can I get (if it is even possible) the code coverage report running on a remote JAVA VM in Eclipse

所以我有一个单元测试套件服务层(VM2)的客户端(为简便起见,VM1)。 (该项目已经以这种方式设置,并且太深了,无法重新构造该部分)。

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>

所以希望对类似EclEmma的代码覆盖工具做类似的事情。

So was hoping to do something similar for a code coverage tool like EclEmma.

后端服务架构看起来很像这样:
https://github.com/GoogleCloudPlatform/appengine-modules-sample-java

The backend services architecture looks a lot like this: https://github.com/GoogleCloudPlatform/appengine-modules-sample-java

我怀疑需要添加某种也挂在我的服务层上。 (也许在父Maven文件中)

I am suspecting would need to be adding some kind of hook on my service layer as well. (maybe in the parent maven file)

推荐答案

您可以在 tcpserver中启动JaCoCo(Eclipse EclEmma插件背后的代码覆盖引擎) 模式-请参见 http://www.jacoco。 org / jacoco / trunk / doc / agent.html

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

并连接到它

  • 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

这篇关于Java远程VM上的代码覆盖率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆