Java中的代码覆盖工具 [英] Code coverage tools in Java

查看:132
本文介绍了Java中的代码覆盖工具的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Java中是否有任何此类代码覆盖工具可以为程序提供不同的路径。基本上,这个想法是确保在执行期间覆盖所有循环和嵌套循环。这是为了能够确定代码库中的所有循环是否至少已经执行了一次迭代。

解决方案

Cobertura ,EMMA甚至Clover只做分支/决策覆盖(当然除了行/陈述覆盖)。 Clover还提供方法覆盖(仅测量在执行期间是否输入了一个方法)。



对于路径覆盖率(加上行/声明覆盖率),尝试 JMockit Coverage



可以在此处找到样本报告。<实际上,截至目前,这只是新路径覆盖支持的初始版本,我仍需要改进。


Are there any such code coverage tools in Java that give the different paths in the program. Basically the idea is to ensure that all loops and nested loops are covered during execution. That is to be able to ascertain if all the loops in a code base have been executed at least through one iteration.

解决方案

Cobertura, EMMA and even Clover only do branch/decision coverage (in addition to line/statement coverage, of course). Clover also provides method coverage (which simply measures if a method was entered at all during execution).

For path coverage (plus line/statement coverage), try JMockit Coverage.

A sample report can be found here.

Actually, as of now this is only an initial version of the new path coverage support, which I still need to improve.

这篇关于Java中的代码覆盖工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆