Code coverage calculation issue with Visual Studio & Azure Pipeline

Chetan Navale 1 Reputation point
2021-04-16T04:34:45.627+00:00

Hello,
We are developing .NET Core 3.1 application using Visual Studio 2019. Code development is complete and also we have written unit test cases in XUnit for the code.
For code coverage calculations, we have used SonarLint extension in Visual Studio. When we are running Test explorer there is no issue with test cases and also it is showing code coverage as 77% in Code coverage results screen.
I am not sure whether it is code coverage calculated by Visual Studio inbuilt tool or Sonarlint.
Also when we push this code to azure repository and try building the pipeline with azure CICD including MSbuild, sonarqube tasks, code coverage is not getting calculated.
Herewith I have attached code coveragexml file screen shot that is getting generated by Visual studio which shows everything null also attaching the same file display in visual studio coverage result panel.
We don't understand whether this is correctly generating or its corrupt one.
Need urgent help on this topic.

88480-capture.jpg

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,197 questions
Visual Studio Testing
Visual Studio Testing
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Testing: The act or process of applying tests as a means of analysis or diagnosis.
326 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 27,106 Reputation points Microsoft Vendor
    2021-04-16T09:35:48.323+00:00

    Hello @Chetan Navale ,

    Welcome to Microsoft Q&A forum.

    It seems this issue appeared after you built the project by using Azure Pipeline, since Azure Pipeline is currently not supported in the Microsoft Q&A forum, I suggest you post this issue in Stack Overflow tagged with Azure Pipelines or Azure DevOps, or post in Developer Community to get better help.

    Thanks for your understanding.

    Best Regards,
    Tianyu

    • If the answer is helpful, please click "Accept Answer" and upvote it.
      Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.