将JaCoCo与SONAR集成以实现单元和集成测试覆盖

有没有人试图配置JaCoCo将单元和集成测试的覆盖范围转储到2个不同的文件中,让SONAR使用它们,使用ANT构建?

以下示例显示如何在ANT构建中集成jacoco和sonar:

  • 使用Ant将JaCoCo集成到声纳中

github示例站点提供了一个Java运行器示例,说明了如何集成unit testing和集成测试:

  • 联合UT-IT-声纳的亚军jacoco

应该可以适应这一点。 相关的声纳属性是:

#Tells SonarQube to reuse existing reports for unit tests execution and coverage reports sonar.dynamicAnalysis=reuseReports #Tells SonarQube where the unit tests execution reports are sonar.junit.reportsPath=reports/junit #Tells SonarQube that the code coverage tool by unit tests is JaCoCo sonar.java.coveragePlugin=jacoco #Tells SonarQube where the unit tests code coverage report is sonar.jacoco.reportPath=reports/jacoco/jacoco-ut.exec #Tells SonarQube where the integration tests code coverage report is sonar.jacoco.itReportPath=reports/jacoco/jacoco-it.exec