简体   繁体   English

如何在 Eclipse 中设置 Jacoco 代码覆盖工具以查看 Java 代码中的颜色?

[英]How to set up Jacoco code coverage tool in Eclipse for viewing colors in Java code?

I have setup jacoco in jenkins as part of functional test job to generate code coverage report.我在 jenkins 中设置了 jacoco 作为功能测试工作的一部分来生成代码覆盖率报告。 But I feel its very tough to understand.但我觉得很难理解。

Somewhere I read that covered and uncovered lines of code are shown in colors in Eclipse.我在某处读到,覆盖和未覆盖的代码行在 Eclipse 中以颜色显示。 This is for functional tests which connect to a stage where the whole business logic has been deployed.这是用于连接到部署了整个业务逻辑的阶段的功能测试。 This is present inside Eclipse also as part of the project.这也作为项目的一部分存在于 Eclipse 中。 How to set it up?如何设置?

What difference the setup has for unit tests?设置对单元测试有什么区别?

http://www.eclemma.org/userdoc/importexport.html mentions being able to import reports, but that they have to be exactly the same class files both when the report was generated and within the Eclipse workspace. http://www.eclemma.org/userdoc/importexport.html提到能够导入报告,但在生成报告时和在 Eclipse 工作区中,它们必须是完全相同的类文件。 It may work, it may not.它可能有效,也可能无效。

You can download the Eclemma plugin from Eclipse marketplace.您可以从 Eclipse 市场下载Eclemma插件。

  1. Open Marketplace from Help menu.从“帮助”菜单打开 Marketplace。
  2. Search for Eclemma Java Code Coverage.搜索 Eclemma Java 代码覆盖率。
  3. Install and Restart Eclipse.安装并重新启动 Eclipse。
  4. Right-Click on the project, select Coverage as -> JUnit Test右键单击项目,选择 Coverage as -> JUnit Test

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

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