[英]How to test the code coverage of a java web application in netbeans?
I have a java web application and I use Netbeans6.9.1 to develop it.我有一个 java web 应用程序,我使用 Netbeans6.9.1 开发它。
I wrote some Junit test class of some DAO classes, but I failed to run code coverage test.我写了一些 DAO 类的 Junit 测试 class ,但我未能运行代码覆盖率测试。
It seems NetBeans Code Coverage Plugin does not support java web application code coverage,似乎NetBeans 代码覆盖率插件不支持 java web 应用程序代码覆盖率,
and I can not activate coverage collection as the Tutorial .而且我无法像教程一样激活覆盖收集。
Any ideas?有任何想法吗?
Cobertura is a good code coverage tool, and there's a plugin for NetBeans, too. Cobertura 是一个很好的代码覆盖工具,NetBeans 也有一个插件。
I can confirm that the Codecoverage plug-in works in Netbeans 7.2.我可以确认Codecoverage插件在 Netbeans 7.2 中有效。 However in web projects the Coverage menu option is NOT active:-(但是在 web 项目中,覆盖菜单选项未激活:-(
If you're writing unit tests of DAOs, none of the code will run on the app server yet (since the DAOs should be instantiated in the same JVM as the test class), so you should be able to do code coverage.如果您正在编写 DAO 的单元测试,那么任何代码都不会在应用服务器上运行(因为 DAO 应该在与测试类相同的 JVM 中实例化),因此您应该能够进行代码覆盖。 What exact errors are you getting?你得到了什么确切的错误?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.