Code Coverage is always 0.0%

Code coderage is always 0.0% for a .net project.

Sonarqube-7.7 version and sonarscanner is used.

Visual Studio 2017 is used.

Were are your test results located? We observed that on Azure DevOps Server with the latest testrunner the coverage files were located in temp Directory by Default and not in build directory where SonarQube is searching for them (Azure DevOps Server found the test results). Adjust the settings of the test run or use previous version of the task was our solution.

1 Like

Hi,

I’d like to augment Volker’s interesting tidbit with the fact that for .NET projects you really should be using the SonarScanner for MSBuild, not the vanilla Scanner CLI.

 
Ann

1 Like

Some more background info on this: the location which to the Azure DevOps/Azure DevOps Server Test task drops the coverage files varies depending on how the test task is configured.

By default the Scanner for MSBuild (and therefore the SonarCloud/SonarQube) tasks will search in the build directory for coverage files; and as of v4.6.2 of the Scanner for MSBuild (v4.6.3 SonarQube extension/v1.6.3 of the SonarCloud extension) it will then fall back on searching the build agent temp directory too. See issue #724 for more detail.

1 Like