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

时间:2021-08-12 20:24:04

I've been looking for a code coverage viewer aimed at inspecting live Java applications, mostly webapps running inside an application container like Tomcat. 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 e.g. on a specific user interaction.

我一直在寻找一个代码覆盖率查看器,旨在检查实时Java应用程序,主要是在像Tomcat这样的应用程序容器内运行的webapp。当然,有很多不错的工具可以获得单元测试覆盖率的自动报告,但我的目标更像是实时学习一个不熟悉的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. 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.

Eclipse Java调试器(使用JPDA进行远程调试)非常有用,但前提是您已熟悉应用程序的体系结构。从理论上讲,我可以采用一些覆盖工具并将其设置为每两秒自动刷新静态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. So is there a similar easy-to-set-up GUI tool, free or non-free, for Java?

对于Adobe Flex,FlexCover通过提供覆盖查看器工具来实现我想要的功能,该工具几乎可以实时显示覆盖范围,并且至少对于知道这些内容的人来说,设置起来相对简单。那么Java有一个类似的易于设置的GUI工具,免费或非免费吗?

2 个解决方案

#1


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的coverage数据,而无需从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:

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

And - you need to ensure you are using a threaded flushpolicy. The clover-maven2-plugin uses one by default. If you are using Ant, you will need to set it explicitly on <clover-setup/>.

而且 - 您需要确保使用线程化的flushpolicy。 clover-maven2-plugin默认使用一个。如果您使用的是Ant,则需要在 上明确设置它。

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.

请让我知道你怎么走。

#2


Have a look at clover. It may be what you are looking for. Not free, but nice.

看看三叶草。这可能就是你要找的东西。不是免费的,但很好。

#1


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的coverage数据,而无需从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:

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

And - you need to ensure you are using a threaded flushpolicy. The clover-maven2-plugin uses one by default. If you are using Ant, you will need to set it explicitly on <clover-setup/>.

而且 - 您需要确保使用线程化的flushpolicy。 clover-maven2-plugin默认使用一个。如果您使用的是Ant,则需要在 上明确设置它。

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.

请让我知道你怎么走。

#2


Have a look at clover. It may be what you are looking for. Not free, but nice.

看看三叶草。这可能就是你要找的东西。不是免费的,但很好。