SonarQube如何通过JaCoCo计算覆盖率? [英] How does SonarQube calculate coverage through JaCoCo?

查看:878
本文介绍了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计算覆盖率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆