简体   繁体   English

通过Java Web应用程序中的黑盒测试来测量代码覆盖率

[英]Measure Code Coverage through Black Box testing in java Web application

We have a huge java based application , which is there since few years.We also have a large set of block box test cases with QA team to carry out regression testing. 我们有一个庞大的基于Java的应用程序,它存在几年。我们还有一大组块盒测试用例与QA团队进行回归测试。 There is an initiative being taken in our project to improve the quality of the application and on the same lines we have to measure the code which is getting covered by these black box test cases. 我们的项目正在采取一项措施来提高应用程序的质量,我们必须在同样的方面测量这些黑盒测试用例所涵盖的代码。

I know that we can have a code coverage report through code coverage tools like EMMA,Code Cover,Cobertura ,these tools work along with White Box Unit test cases(ie JUnit test cases). 我知道我们可以通过代码覆盖工具(如EMMA,Code Cover,Cobertura)获得代码覆盖率报告,这些工具与White Box Unit测试用例(即JUnit测试用例)一起工作。

I want to know whether any of these tools can be used to generate similar code coverage reports when black box test cases are executed on the application. 我想知道当在应用程序上执行黑盒测试用例时,是否可以使用这些工具中的任何一个来生成类似的代码覆盖率报告。 With regards to this I have done some google search and found out that the application code can be "Instrumented" and it is possible to generate code coverage reports. 关于这一点,我做了一些谷歌搜索,发现应用程序代码可以“检测”,并可以生成代码覆盖率报告。

Now what I am trying to do is to 1.Instrument the code in Eclipse using "Code pro" eclipse plugin, 2.Once the code is instrumented ,will generate the jar file of the instrumented code and deploy the same on the test Environment (Unix box). 现在我要做的是1.使用“Code pro”eclipse插件在Eclipse中导入代码,2。一旦代码被检测,将生成已检测代码的jar文件并在测试环境中部署它( Unix盒子)。

Now the question is, whether I am going in right direction? 现在的问题是,我是否朝着正确的方向前进? How and where the code coverage reports will be generated when black box testing is being done on the instrumented code on server(not local machine). 在对服务器(非本地计算机)上的检测代码进行黑盒测试时,将如何以及在何处生成代码覆盖率报告。

Take a look at jacoco 看看jacoco吧

http://www.eclemma.org/jacoco/trunk/doc/mission.html http://www.eclemma.org/jacoco/trunk/doc/mission.html

This uses a java agent and can instrument your code at runtime 它使用java代理,可以在运行时检测代码

You can use jacoco for this, set the jvm under to test to run with the tcpserver option, run tests and then connect to it using the tcpclient option. 您可以使用jacoco ,将jvm设置为test以使用tcpserver选项运行,运行测试然后使用tcpclient选项连接到它。 If you want to collect coverage separately for n runs then you can connect to it over jmx and call reset 如果要分别为n次运行收集覆盖范围,则可以通过jmx连接到它并调用reset

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

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