Has any one tried configuring JaCoCo to dump the coverage of unit and integration tests in 2 different files, for SONAR to use them, using ANT build?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
The following example shows how to integrate jacoco and sonar in an ANT build:
- integrating JaCoCo in sonar using Ant
The github samples site gives a Java runner example of how both unit test and integration tests are integrated:
- combined-ut-it-sonar-runner-jacoco
Should be possible to adapt this. The relevant Sonar properties are:
#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