Need help understanding code coverage reporting

Hello, I need some help figuring out the code coverage reporting on my project. Here are the stats reported below:

Coverage: 53.8
Uncovered Lines: 2
Lines to Cover: 28
Uncovered Conditions: 22
Conditions to Cover: 24

I’m not understanding the uncovered conditions part, I have every if condition covered in my unit tests, every line and condition has a yellow line saying “fully covered by tests”. There is only 1 condition in my code (one if statement) with one flag in the condition and I have paths for both true and false. Still saying I have 22 uncovered condition even though that if statement is completely covered. The only uncovered lines are 2 instance variables. I’m trying to get get coverage to 90% but there isn’t anything else to cover and it says 22 uncovered conditions, please advise. Thanks!

  • ALM used Azure DevOps
  • CI system used Azure DevOps
  • Languages used Java

I’ve found that the margin indicators for sonarcloud UI when viewing a code file arent always right.

That said, Sonar is using whatever coverage report that was generated from your pipeline with a little bit of extra stuff bolted on like the sonar.exclusions, etc. Its not actually analyzing coverage independently, so the coverage report your pipeline generates probably has these confusing results in it. If that report looks wrong, try updating JCoCo/OpenClover/whatever you are using for coverage (or pick an older version if you are using the latest).

1 Like

Thanks, I’ve figured it out. I had JaCoCo reporting my lombok generated code which severely skewed the results. It’s fixed now.