简体   繁体   English

用于检查实时Java应用程序的实时代码覆盖查看器工具?

[英]Real time code coverage viewer tool for inspecting live Java apps?

I've been looking for a code coverage viewer aimed at inspecting live Java applications, mostly webapps running inside an application container like Tomcat. 我一直在寻找一个代码覆盖率查看器,旨在检查实时Java应用程序,主要是在Tomcat等应用程序容器内运行的webapp。 Sure, there are a number of decent tools for getting automatic reports of unit test coverage, but my aim is more like learning in real time what an unfamiliar Java app does eg on a specific user interaction. 当然,有很多不错的工具可以获得单元测试覆盖率的自动报告,但我的目标更像是实时了解一个不熟悉的Java应用程序,例如特定的用户交互。

The Eclipse Java debugger (with JPDA for remote debugging) is really useful, but only if you are already familiar with the application's architecture. Eclipse Java调试器(使用JPDA进行远程调试)非常有用,但前提是您已熟悉应用程序的体系结构。 And in theory, I could take some coverage tool and set it up to auto-refresh static HTML coverage reports every two seconds, but this is far from optimal. 从理论上讲,我可以采用一些覆盖工具并将其设置为每两秒自动刷新静态HTML覆盖率报告,但这远非最佳。

For Adobe Flex, FlexCover does just what I want by providing a coverage viewer tool that visualizes the coverage in nearly real time, and it's relatively simple to set up at least for somebody who knows the stuff. 对于Adobe Flex,FlexCover通过提供覆盖查看器工具来实现我想要的功能,该工具几乎可以实时显示覆盖范围,并且至少对于知道这些内容的人来说,设置起来相对简单。 So is there a similar easy-to-set-up GUI tool, free or non-free, for Java? 那么Java有一个类似的易于设置的GUI工具,免费或非免费吗?

You can view Clover's coverage data generated by a web application, in Eclipse, without the need to start the web server from Eclipse. 您可以在Eclipse中查看由Web应用程序生成的Clover的覆盖率数据,而无需从Eclipse启动Web服务器。

The trick is to configure the initString in the Eclipse Clover Config screen to point to the same clover.db that your webapp is using: 诀窍是在Eclipse Clover Config屏幕中配置initString以指向您的webapp正在使用的clover.db:

Clover initString配置

And - you need to ensure you are using a threaded flushpolicy . 而且 - 您需要确保使用线程化的flushpolicy The clover-maven2-plugin uses one by default. clover-maven2-plugin默认使用一个。 If you are using Ant, you will need to set it explicitly on <clover-setup/>. 如果您使用Ant,则需要在<clover-setup />上明确设置它。

You must also ensure you are using the same version of Clover in both Eclipse and your build tool. 您还必须确保在Eclipse和构建工具中使用相同版本的Clover。

I have tested this locally - and it works quite well! 我在本地进行过测试 - 效果很好!

Please let me know how you go. 请让我知道你怎么走。

Have a look at clover . 看看三叶草 It may be what you are looking for. 这可能就是你要找的东西。 Not free, but nice. 不是免费的,但很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM