SonarScala test counts

Hi All,

First of all, thanks to the team for the amazing work they’ve done on the SonarScala plugin.

I was trying out version 1.5.0 of the plugin on SonarQube 6.7.6, using SonarScanner 3.3 and sbt-scoverage 1.3.3. I haven’t done any sort of additional configuration of SonarQube, just installed the community edition and then installed the SonarScala plugin. The plugin is great but I noticed that it doesn’t report test counts (and success/failure rates for tests). Under ‘MyProjectName > Measures > Coverage’, I can see everything populated except for the ‘Tests’ category. The properties I use are as follows:

-sonar.language=scala
-sonar.sources=src/main/scala
-sonar.tests=src/test/scala
-sonar.scala.coverage.reportPaths=target/scala-2.10/scoverage-report/scoverage.xml
-sonar.junit.reportPaths=target/test-reports

I’ve tried this both for a multi-module project and a single-module project and was wondering if this feature is just not supported yet or is an actual issue.

Appreciate your help!
Toni

Hello Toni,

I am glad to hear that you appreciate our plugin!

Concerning your question, the reason is that coverage and test results are in fact 2 different metrics not imported at the same time.
If you look at the documentation, you can see that you can import Scala coverage, but test execution are not supported. And in fact, I am not even sure that scoverage report contains such information!

I hope this clarify the situation.

Best,
Quentin

Thanks Quentin, that makes sense.

Do you happen to know whether test results are going to be included in the future? From the scanner logs, I can see that the ‘sonar.junit.reportPaths’ property is currently not being used for *.scala. Libraries like Specs2 and Scalatest are able to produce JUnit-xml files, so I guess we should be able to make use of the mentioned property?

Thanks,
Toni

Just to be sure, did you try to import test results with sonar.junit.reportPaths?
From a quick look at the code, I would be surprised if it works as it is for Scala!

In any case, I created a ticket (SONARSLANG-432), to keep track of this feature.

Sorry about the confusion, I didn’t explain properly.

Yep, I did try this property out but, as mentioned, I didn’t see it being used by the scala sensor. I was thinking along the lines that the functionality of this property could be reused since we are able to produce JUnit-xmls.

Okay, no problem, it’s clear now!

The conclusion is that this property can not be used for Scala, the documentation is correct, and a ticket has been created to track the feature!

Great, thanks for your help Quentin!