Azure DevOps - Sonar Cloud - VSTest@2

Hello,

We have sonarcloud integrated with azure devops, and we are using VSTest@2 to run the unit tests. We are facing a problem with code coverage not getting reflected after adding unit tests for some methods. We have noticed that this problem occurs only for async Tasks. I have to mention that we have verified and all the tests are executed and passing, the issue is that Sonar Cloud is not reflecting these changes and is seeing those lines of code uncovered by unit tests.
Wondering if some of you have had the same problem and if you managed to find a solution for this.

Thanks!

Hi,

Welcome to the community!

To be clear, the coverage from some of your tests are reflected in SonarCloud but others are not? And all tests are instrumented / executed with the same tools? I ask because I’m trying to verify that the covered/uncovered tests really are apples-to-apples. And if they’re not apples-to-apples, what are the differences?

 
Thx,
Ann

Hi,

Thank you for your response! Yes, the coverage from some tests is reflected in SonarCloud, but we’ve noticed that sometimes, some lines of code from async Tasks are not getting reflected as covered. We are using a yaml template for the CI/CD process for all our projects, and the VSTest@2 tool is used to execute the tests.

Best regards,
Andres

Hi Andres,

Can you check your coverage report and verify that the missing lines actually show up as covered there, please?

 
Thx,
Ann