我检查了几乎所有与我的问题类似的问题,并尝试将它们测试两天。所以,我在这里问: 我正在使用:SonarQube服务器5.6.6和SonarQube扫描仪3.0.3.778。 已根据此示例项目设置了sonar.properties:combined-ut-it-sonar-runner-jacoco
有关更多说明,请检查我为此项目设置的分析参数:
sonar.sources=src/main/java
sonar.tests=src/test/java
sonar.java.binaries=target/classes
sonar.java.test.binaries=target/test-classes
sonar.jacoco.reportPath=target/coverage-reports/jacoco-ut.exec
sonar.jacoco.itReportPath=target/coverage-reports/jacoco-it.exec
sonar.junit.reportsPath=target/surefire-reports
我收到的日志信息:(我在此处将相关日志放入我的参数中)
INFO: Source paths: src/main/java
INFO: Test paths: src/test/java
INFO: Sensor SurefireSensor
INFO: parsing /home/jenkins-slave/workspace/team/project/target/surefire-reports
INFO: Sensor SurefireSensor (done) | time=382ms
INFO: Sensor JaCoCoSensor
INFO: Analysing /home/jenkins-slave/workspace/team/project/target/coverage-reports/jacoco-ut.exec
INFO: No information about coverage per test.
INFO: Sensor JaCoCoSensor (done) | time=602ms
INFO: Sensor JaCoCoItSensor
INFO: Analysing /home/jenkins-slave/workspace/team/project/target/coverage-reports/jacoco-it.exec
INFO: No information about coverage per test.
INFO: Sensor JaCoCoItSensor (done) | time=326ms
INFO: Sensor JaCoCoOverallSensor
INFO: Analysing /home/jenkins-slave/workspace/team/project/target/coverage-reports/jacoco-ut.exec
INFO: Analysing /home/jenkins-slave/workspace/team/project/target/coverage-reports/jacoco-it.exec
INFO: Analysing /home/jenkins-slave/workspace/team/project/.scannerwork/jacoco-overall.exec
INFO: No information about coverage per test.
INFO: Sensor JaCoCoOverallSensor (done) | time=348ms
现在在sonarQube中,我可以看到集成覆盖和单元测试覆盖的单独结果:
但是没有详细信息,例如单位测试的覆盖范围。理想情况下,我希望获得以下信息:https://docs.sonarqube.org/display/SONAR/Seeing+Tests
现在我的问题是:因为我已经正确地指出了surefire报告(包含surefire xml文件的文件夹报告)以及jacoco报告,我如何才能获得有关每次测试的覆盖率的信息?我在这里错过了什么吗?我有点困惑,因为我不知道sonar.junit.reportsPath和sonar.surefire.reportsPath之间的确切区别?我完全不了解哪个人负责提供每次测试的覆盖率信息:surefire报告或jacoco报告?基于日志文件,似乎jacoco对此负责。那么,这个分析中的万无一失的报告角色是什么?
我将不胜感激。