Reputation: 6667
I can't figure out how to get the "Unit Test SUccess" section to appear on my SonarQube dashboard. I've tried setting every sonar and sonar.java I can think of but they just don't appear. I am using the "sbt-sonarrunner-plugin", version 1.0.4, and Jacoco for calculating coverage. Any help would be greatly appreciated, as everything I have found says that settings the sonar.junit.reportsPath property should make it work. For reference I have also tried setting the sonar.test property and it didn't work either.
This is what the unit test widget looks like.
Here are my properties, the project name and directory are passed in.
val commonSonarProperties = Map(
"sonar.projectName" -> s"$projectName",
"sonar.junit.reportsPath" -> s"$projectDir/target/test-reports",
s"$projectName.sonar.sources" -> s"$projectDir/src/main/java",
"sonar.java.binaries" -> s"$projectDir/target/classes",
"sonar.java.test" -> s"$projectDir/src/test/java",
"sonar.java.test.binaries" -> s"$projectDir/target/test-classes",
"sonar.java.coveragePlugin" -> "jacoco",
"sonar.jacoco.reportPath" -> s"$projectDir/target/jacoco/jacoco.exec",
"sonar.jacoco.itReportPath" -> s"$projectDir/target/it-jacoco/jacoco.exec"
)
Upvotes: 2
Views: 3527
Reputation: 117
I had the similar problem, where jenkins wasn't able to read the .exec file of jacoco. Upon checking sonar-project.properties i found that these two fields were empty:
sonar.junit.reportsPath=
sonar.jacoco.reportPath=
Upvotes: 0
Reputation: 6667
I figured out what was going wrong. I noticed in the logs when I ran Sonar with log level set to debug I was getting the following message.
- parsing <directory>/target/test-reports
- Reports path contains no files matching TEST-.*.xml : <directory>/target/test-reports
I had set my "sonar.junit.reportsPath" correctly, but Sonar was expecting the xml files in my directory to start with "TEST-". When I renamed the xml files to start with TEST- the results then displayed on the dashboard.
Upvotes: 3