SonarQube如何通过JaCoCo计算覆盖率?

编程入门 行业动态 更新时间:2024-10-09 19:21:45
本文介绍了SonarQube如何通过JaCoCo计算覆盖率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

JaCoCo仅输出jacococ.exec,这是Sonar的输入.在该文件中,似乎只有信息:

JaCoCo just outputs jacococ.exec which is the input for Sonar. In that file, there seems to be only the info:

- Class name - Total Class Probes - Executed Class Probes

但是,SonarQube不能仅依赖于这些值,因为它需要告诉您哪些是未收敛的确切行,因此Sonar对其自身进行了分析.那么它如何使用Jacoco报告?为什么需要它?

But then, SonarQube cannot rely solely on these values as it needs to tell you which are the exact lines unconvered, so Sonar is performing an analysis on itself. So how does it use Jacoco report? And why does it need it?

推荐答案

那么它如何使用Jacoco报告?为什么需要它?

So how does it use Jacoco report? And why does it need it?

仅靠SonarQube本身不知道您实际上执行了哪些测试以及它们如何覆盖您的代码.要获取此信息,它依赖于第三方测试覆盖率工具.对于Java,它依赖于JaCoCo收集和提供的数据,如解释为(JaCoCo收集了exec文件中的执行信息,并在生成报告期间从class文件中获取行号和其他信息),或者SonarQube可以依赖通用格式" .

SonarQube itself alone doesn't / can't know anything about which tests you actually executed and how they cover your code. To obtain this information it relies on third-party test coverage tools. In case of Java it relies on data collected and provided by JaCoCo as explained in answer on similar question from you (JaCoCo collects execution information in exec file, and obtains line numbers and other information from class files during generation of report), or SonarQube can rely on data in "generic format".

更多推荐

SonarQube如何通过JaCoCo计算覆盖率?

本文发布于:2023-10-19 17:29:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1508254.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:覆盖率   SonarQube   JaCoCo

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!