How does SonarQube calculate coverage through JaCoCo?

Deadly 提交于 2020-01-03 06:16:28

问题


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

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?


回答1:


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

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".



来源:https://stackoverflow.com/questions/55149460/how-does-sonarqube-calculate-coverage-through-jacoco

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!