We have a WebAPI project written in C# and using Visual Studio 2019. We have also written unit test cases using nunit framework for the WebAPI project. We are using Azure DevOps pipeline to build and deploy the solution. With the Azure DevOps pipeline we have integrated the SonarQube for reporting the code quality and code coverage. We are using “SonarQubePrepare@4” and “VSTest@2” tasks in DevOps pipeline with below properties.
task: SonarQubePrepare@4 displayName: Test inputs: SonarQube: 'xxxx' scannerMode: 'MSBuild' projectKey: 'xxxxx' extraProperties: | sonar.cs.vscoveragexml.reportsPaths = $(System.DefaultWorkingDirectory)\Test\**\*.coveragexml task: VSTest@2 displayName: VSTest continueOnError: true inputs: testSelector: 'testAssemblies' testAssemblyVer2: | **\*Tests.dll !**\*TestAdapter.dll !**\obj\** searchFolder: '$(System.DefaultWorkingDirectory)' resultsFolder: '$(System.DefaultWorkingDirectory)\Test' codeCoverageEnabled: true
We are seeing different code coverage report in VS Test report and SonarQube report.
Code Coverage in VS test
Code Coverage in SonarQube
Please let me know how can I show the VS Test report in the SonarQube report.