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计算覆盖率?
发布评论