SonarQube Scoverage Conditional Coverage

We are currently using SonarQube Version 7.7 and Scoverage 1.3.0 as the code coverage tool. From the documentation, I am using the property sonar.scala.coverage.reportPaths=target/scoverage.xml to point to my coverage report. I noticed that in the UI, though I get the Statement Coverage details, I do not see any Conditional Coverage details. I wanted to know whether conditional coverage using scoverage is not yet supported or do I need to upgrade any the libraries I am using.

Thank you.

1 Like

Hi, can this be related to your issue?

Hi. Yes. it is essentially the same issue except for that I do see coverage details but not the conditional coverage details.

Hello @arevanth,

Conditional coverage for Scala is not available.

The reason is that Scoverage computes “only” statement and branch coverage.

We can compute an approximation of line coverage, by considering a line as hit when at least one statement is covered at that line. Please note that we therefore display line and not statement coverage.

Computing condition coverage from what Scoverage provides us may be possible, but it seems far from trivial and requires deep knowledge of Scoverage features and limitations, I don’t think we plan to make this effort in the near future.

In this case, the coverage is imported as expected, I therefore think that it’s unrelated.

I hope this helps.
Best,
Quentin

Hey @Quentin ,

With regards to Condition Coverage, is it worth considering JaCoCo as a good replacement of Scoverage? It seems that it is available for Scala and supports quite a few metrics:

https://www.scala-sbt.org/sbt-jacoco/getting-started.html

Regards,
Toni

I am not really familiar with Jacoco for Scala, the limitations and the differences with Scoverage.

What I can say is that if Jacoco provides features that you are interested on and you are satisfied by the results, I see no strong push-back in not using it! (Or at least have a try)