用于代码覆盖的 Eclipse 插件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9046171/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 20:52:44  来源:igfitidea点击:

Eclipse plugin for code coverage

eclipseeclipse-plugincode-coverage

提问by Kiva

I search a code coverage plugin for eclipse. My question is simple:

我搜索了 Eclipse 的代码覆盖率插件。我的问题很简单:

Which plugin do you use with eclipse for code coverage and why ?

您在 eclipse 中使用哪个插件来实现代码覆盖率,为什么?

回答by ziesemer

Edit (2015)- My current recommendation: EclEmma/ JaCoCo.

编辑 (2015)- 我目前的推荐:EclEmma/ JaCoCo

Not sure why I didn't see this back in January 2012, as there was clearly active development with new versions consistently being reproduced even back then.

不知道为什么我在 2012 年 1 月没有看到这一点,因为即使在那个时候,新版本的开发也很明显。

I've since become a bit frustrated with Cobertura / eCobertura, as development since seems to have stalled, with support for current Java versions starting to be somewhat lacking.

从那以后,我对 Cobertura / eCobertura 感到有些沮丧,因为自那以后的开发似乎已经停滞,对当前 Java 版本的支持开始有些缺乏。

JaCoCo may have advanced since I last looked at this in 2012 (or I simply missed it entirely, or was looking at EMMA vs. JaCoCo) - but the current version provides excellent support built-in to Eclipse (provided by EclEmma) as well as many other IDEs, support for Apache Maven, Apache Ant, command-line, Java API, and many other third-party integrations. Please refer to the complete list at http://www.eclemma.org/jacoco/trunk/doc/integrations.html.

JaCoCo 可能自 2012 年我上次看到它以来已经有了进步(或者我只是完全错过了它,或者正在查看 EMMA 与 JaCoCo) - 但当前版本提供了 Eclipse(由 EclEmma 提供)内置的出色支持以及许多其他 IDE,支持 Apache Maven、Apache Ant、命令行、Java API 和许多其他第三方集成。请参阅http://www.eclemma.org/jacoco/trunk/doc/integrations.html上的完整列表。

I am now switching some of my projects over to JaCoCo from Cobertura, and am very impressed by the integration and results - both in Maven reports as well as Eclipse. Not sure about competing solutions, but JaCoCo can even be configured to fail a build if certain thresholds of code coverage are not met.

我现在正在将我的一些项目从 Cobertura 切换到 JaCoCo,并且对集成和结果印象非常深刻 - 无论是在 Maven 报告还是 Eclipse 中。不确定竞争解决方案,但如果不满足某些代码覆盖率阈值,JaCoCo 甚至可以配置为使构建失败。

JaCoCo is specifically documented to support Java class files from version 1.0 all the way through 1.8*.

JaCoCo 专门记录为支持从 1.0 版一直到 1.8 *版的 Java 类文件。

I find their Mission Statementvery respect-worthy.

我发现他们的使命宣言非常值得尊重。



References / Resources:

参考资料/资源:

Especially as this question has unfortunately been closed, here is a mini-directory of some of the various references and resources that I used in making my decision - and which I encourage everyone here to refer to in order to make their own decisions.

特别是因为这个问题已经很不幸地被关闭了,这里是我在做出决定时使用的一些各种参考资料和资源的小目录 - 我鼓励这里的每个人参考以做出自己的决定。



Previous:

上一篇

eCobertura.

电子科贝图拉

It does the job, it is free and open-source, it is more up-to-date than EMMA, and it is used by most of the other online open-source projects I'm familiar with. It also integrates very well into Maven - including some rather nice-looking reports.

它完成了这项工作,它是免费和开源的,它比EMMA 更新,并且我熟悉的大多数其他在线开源项目都使用它。它还可以很好地集成到 Maven 中——包括一些相当漂亮的报告。

If you want to consider a commercial product, I'd consider Atlassian's Clover.

如果您想考虑商业产品,我会考虑 Atlassian 的Clover

回答by Kane

I like http://codecover.org/

我喜欢http://codecover.org/

The source highlighting is better than eCobertura, the drill-down is easy to read, selecting test cases is easy, it actually provides statistics for statement, branch, loop and condition coverage ( a lot of plugins only do statement, which is kinda useless ).

源码高亮比eCobertura好,下钻易读,选择测试用例容易,实际上提供了语句、分支、循环和条件覆盖的统计(很多插件只做语句,有点没用) .

We use it at our business and we found it the best plugin by far.

我们在我们的业务中使用它,我们发现它是迄今为止最好的插件。

回答by ka3ak

Coverlipse: http://coverlipse.sourceforge.net/because it's free

Coverlipse:http://coverlipse.sourceforge.net/ 因为它是免费的