i am using sonarQube-8.5.1.38104 and i am using it in my scala project and followed this link
here is my plugins.sbt file
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")
addSbtPlugin("com.github.mwz" % "sbt-sonar" % "2.2.0")
and here is my build.sbt file
import sbtsonar.SonarPlugin.autoImport.sonarUseExternalConfig
coverageEnabled := true
sonarProperties ++= Map(
"sonar.host.url" -> "http://127.0.0.1:9000",
"sonar.projectName" -> "myproject-backend",
"sonar.projectKey" -> "sonar-myproject-backend",
"sonar.sources" -> "src/main/scala-2.13",
"sonar.tests" -> "src/test/scala-2.13",
"sonar.junit.reportPaths" -> "target/test-reports",
"sonar.sourceEncoding" -> "UTF-8",
"sonar.scala.scoverage.reportPath"->"target/scala-2.13/scoverage-report/scoverage.xml",
"sonar.scala.scapegoat.reportPath" -> "target/scala-2.13/scapegoat-report/scapegoat.xml"
)
followed sbt-scoverage
then i did
-> sbt -> coverage -> test -> coverageReport
generated the report
[info] Written Cobertura report [/home/user/git/myproject/target/scala-2.13/coverage-report/cobertura.xml]
[info] Written XML coverage report [/home/user/git/myproject/target/scala-2.13/scoverage-report/scoverage.xml]
[info] Written HTML coverage report [/home/user/git/myproject/target/scala-2.13/scoverage-report/index.html]
[info] Statement coverage.: 38.67%
[info] Branch coverage....: 31.58%
then i did
sonarScan
and check the report at http://127.0.0.1:9000/dashboard?id=myproject-backend
then code coverage is displayed 0.0% and Unit tests -
and i have checked the reports exists at
target/scala-2.13/scoverage-report/scoverage.xml
target/scala-2.13/scapegoat-report/scapegoat.xml
and class test reports exists at
target/test-reports
com.myproject.test.abctest.EventTest.xml com.myproject.test.xyztest.FileUploadTest.xml TEST-com.myproject.test.xyztest.DirectoryCreationTest.xml
com.myproject.test.abctest.QueryEventTest.xml TEST-com.myproject.test.abctest.InsertEventTest.xml TEST-com.myproject.test.xyztest.FileUploadTest.xml
com.myproject.test.xyztest.DirectoryCreationTest.xml TEST-com.myproject.test.abctest.QueryEventTest.xml
why i am getting code coverage 0% then ? what am i missing here ? please guide ,thanks