java webstart/jnlp 应用程序的代码覆盖率工具
我一直在寻找可以与我的客户端/服务器应用程序一起使用的代码覆盖工具,但我一直无法找到兼容的工具。
我的应用程序将图像存储在服务器上,然后通过通过 java webstart/jnlp 文件启动的客户端显示它们。
任何建议将不胜感激。我已经尝试过艾玛和三叶草,没有结果。开源或商业解决方案是可以接受的。谢谢!
I have been searching for some time for a code coverage tool that will work with my client/sever application, but I have been unable to find a compatible tool.
My application stores images on a server, then displays them though a client which is launched via java webstart/jnlp file.
Any recommendations would be appreciated. I have already tried emma & clover, with no results. open source or commercials solutions are acceptable. thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用您喜欢的任何代码覆盖率工具对类进行检测(例如 cobertura,它会写入本地文件 cobertura.ser,然后可以在单独的步骤中将其用于生成报告)。
然后,不要直接在浏览器中运行已签名或未签名(无论如何都不起作用)的 Applet,而是使用 AppletViewer 环境。查看器在特权环境中运行 Applet,无需 Java 插件沙箱,因此代码覆盖工具可以完成其工作并写入报告文件。
许多代码覆盖工具使用字节码编织,并且仅在虚拟机关闭时使用关闭挂钩写入结果。在浏览器中使用时这可能不起作用,因为这是一个特殊的虚拟机。不确定,但也许 Java 插件会为 Applet 启动一个单独的 VM,而该 VM 永远不会关闭。
Instrument the classes with any of the code coverage tools you like (e.g. cobertura, which writes a local file cobertura.ser which can then be used for the report generation in a separate step).
Then, instead of running the signed or unsigned (which wouldn't work anyway) Applet directly in the browser, use the AppletViewer environment. The viewer runs the Applet in a privileged environment, without the Java Plugin Sandbox and thus the code coverage tool can do its work and write the report file.
Many of the code coverage tools use byte-code weaving and only write their results using a shutdown hook - when the VM shuts down. That is probably not working when used in a browser, since that's a special VM. Not sure, but maybe the Java Plugin starts a separate VM for Applets which is never being shut down.