'How to get Unit Test counts in SonarQube for a Scala SBT build

Note: We are executing this as part of CI build in Teamcity

Step 1: Getting coverage details addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")

Step 2: SBT functions to generate coverage report clean compile coverage test coverageReport

Step 3: Run Sonar scan to upload to sonar server

%teamcity.tool.sonar-qube-scanner%\bin\sonar-scanner 
-Dsonar.projectKey="%Sonar.ProjectKey%" 
-Dsonar.projectName="%Sonar.ProjectName%" 
-Dsonar.projectVersion="Latest" 
-Dsonar.login="%Sonar.UserToken%" 
-Dsonar.host.url="%Sonar.ServerUrl%" 
-Dsonar.links.ci=%system.TeamCity_Url%/viewType.html?buildTypeId=%system.teamcity.buildType.id% 
-Dsonar.branch.name=%teamcity.build.branch% 
-Dsonar.sources="%Sonar.Sources%" 
-Dsonar.scala.coverage.reportPaths="%Sonar.ScoverageReportpath%"

So with these steps we are able to get test coverage % however , we do not get the Unit Test execution details, e.g. Test count, Test Pass% ( the "test" tab under measures> coverage > (coverage details) is not there)

Any ideas what might be a workaround or alternate for this?



Solution 1:[1]

you must have to be include

sonar.tests=src/test/scala
sonar.junit.reportPaths= test-to/test-reports

Hope this will work for you

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Suraj Rao