用于代码覆盖的 Eclipse 插件

2022-01-16 00:00:00 code-coverage eclipse-plugin eclipse

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

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 ?

推荐答案

编辑 (2015) - 我目前的建议:EclEmma/JaCoCo.

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

不知道为什么我在 2012 年 1 月没有看到这一点,因为当时显然正在积极开发新版本,甚至在那时也一直在复制.

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.

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

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.

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

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 .

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

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.

JaCoCo 专门记录了从 1.0 版到 1.8 版的 Java 类文件*.

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

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

I find their Mission Statement very respect-worthy.

参考/资源:

尤其不幸的是,这个问题已被关闭,这里有一个迷你目录,其中包含我在做出决定时使用的一些各种参考资料和资源 - 我鼓励这里的每个人都参考这些资料,以便做出自己的决定.

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.

  • https://en.wikipedia.org/wiki/Java_Code_Coverage_Tools - 维基百科的性质更像是一个动态文档",并有望通过任何可能可用的新相关工具保持更新.
  • 以下内容在某种程度上也应属于动态文档"的同一类别,但可能存在偏见/利益冲突 - 因为每个都来自同样生产此类工具的供应商或组织:
    • http://www.eclemma.org/resources.html(提供 EclEmma,JaCoCo)
    • https://confluence.atlassian.com/display/CLOVER/Comparison+of+code+coverage+tools(提供 Atlassian Clover)
    • https://en.wikipedia.org/wiki/Java_Code_Coverage_Tools - by Wikipedia's nature is more of a "living document", and will hopefully remain updated with any new related tools that may become available.
    • The following should also somewhat fall into the same category of a "living document", but fall under probable bias / conflicts of interest - as each is from the vendor or organization that also produces such a tool:
      • http://www.eclemma.org/resources.html (Provides EclEmma, JaCoCo)
      • https://confluence.atlassian.com/display/CLOVER/Comparison+of+code+coverage+tools (Provides Atlassian Clover)
      • 声纳中的代码覆盖率工具(JaCoCo、Cobertura、Emma)比较(2012-12-19,Patroklos Papapetrou,onlysoftware.wordpress.com)
      • Eclipse 代码覆盖插件(2012-01-28,stackoverflow.com)
      • 测试覆盖率:jaCoCo vs Clover2(Jakub Kurlenda,2010-12-28,kurlenda.blogspot.com)
      • Java 代码覆盖率:Cobertura vs. Emma vs Clover(Tom Borthwick,2010-10-23,copperykeenclaws.com)
      • 选择你的代码覆盖工具声纳 2.2(2010-08-05,Evgeny Mandrikov,sonarqube.org)
      • 追求代码质量:不要被覆盖面所迷惑报告(Andrew Glover,2006-01-31,ibm.com)
      • Code Coverage Tools (JaCoCo, Cobertura, Emma) Comparison in Sonar (2012-12-19, Patroklos Papapetrou, onlysoftware.wordpress.com)
      • Eclipse plugin for code coverage (2012-01-28, stackoverflow.com)
      • Test coverage: jaCoCo vs Clover2 (Jakub Kurlenda, 2010-12-28, kurlenda.blogspot.com)
      • Java Code Coverage: Cobertura vs. Emma vs Clover (Tom Borthwick, 2010-10-23, copperykeenclaws.com)
      • Pick your code coverage tool in Sonar 2.2 (2010-08-05, Evgeny Mandrikov, sonarqube.org)
      • In pursuit of code quality: Don't be fooled by the coverage report (Andrew Glover, 2006-01-31, ibm.com)

      上一个:

      eCobertura.

      它可以胜任,它是免费和开源的,它比 EMMA,它被我熟悉的大多数其他在线开源项目所使用.它还可以很好地集成到 Maven 中 - 包括一些相当漂亮的报告.

      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.

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

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

相关文章