SonarRunner doesn't report tests to SonarQube instances using Java Ecosystem 1.5+


(andrew.oberstar) #1

The SonarRunnerPlugin is currently passing the path to JUnit reports using the ‘sonar.surefire.reportsPath’ property:

File testResultsDir = project.test.reports.junitXml.destination
            properties["sonar.surefire.reportsPath"] = testResultsDir.exists() ? testResultsDir : null

With the Java Ecosystem 1.5 plugins they removed that property (which was deprecated) in favor of ‘sonar.junit.reportsPath’.

I propose that the code be modified to set both properties, in order to provide compatibility for both sets of SonarQube users.

File testResultsDir = project.test.reports.junitXml.destination
            properties["sonar.surefire.reportsPath"] = testResultsDir.exists() ? testResultsDir : null
            properties["sonar.junit.reportsPath"] = testResultsDir.exists() ? testResultsDir : null

(andrew.oberstar) #2

FYI, this results in SonarQube thinking you have 0 unit tests.


(Peter Niederwieser) #3

Thanks, raised as GRADLE-3005. A pull request would be appreciated.