SonarQube是如何通过JaCoCo计算覆盖率的?
How does SonarQube calculate coverage through JaCoCo?
JaCoCo 只输出 jacococ.exec,这是 Sonar 的输入。在该文件中,似乎只有信息:
- Class name
- Total Class Probes
- Executed Class Probes
但是,SonarQube 不能仅仅依赖这些值,因为它需要告诉您哪些是未转换的确切行,因此 Sonar 正在对自身进行分析。那么它是如何使用Jacoco报告的呢?为什么需要它?
So how does it use Jacoco report? And why does it need it?
SonarQube 本身并不知道/不能知道您实际执行了哪些测试以及它们如何覆盖您的代码。要获取此信息,它依赖于第三方测试覆盖率工具。在 Java 的情况下,它依赖于 JaCoCo 收集和提供的数据作为 (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".
JaCoCo 只输出 jacococ.exec,这是 Sonar 的输入。在该文件中,似乎只有信息:
- Class name
- Total Class Probes
- Executed Class Probes
但是,SonarQube 不能仅仅依赖这些值,因为它需要告诉您哪些是未转换的确切行,因此 Sonar 正在对自身进行分析。那么它是如何使用Jacoco报告的呢?为什么需要它?
So how does it use Jacoco report? And why does it need it?
SonarQube 本身并不知道/不能知道您实际执行了哪些测试以及它们如何覆盖您的代码。要获取此信息,它依赖于第三方测试覆盖率工具。在 Java 的情况下,它依赖于 JaCoCo 收集和提供的数据作为 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".