How to show code coverage of test project itself

I am using SonarCloud for a .NET Core 3.1 application to collect as much information of the CI system (Azure Pipelines) as I can. So far so good; I have been able to include code coverage of my main source project, as well as the test results (in .trx format).

Now I am wondering if I can include code coverage results of the test projects themselves (i.e. not just the code they are calling, which is already working fine). I believe this information should already be in the coverage report being uploaded but, for some reason, it is not appearing in my project page.

Is there any setting that I need to change for this information to appear?

A few more details:

Thanks!
Fernando

Hi @fernandreu and welcome to the community !

By design, tests projects classified as such by our analyzer don’t get any analysis nor coverage.

However, you can explicitely include wanted analyzed tests projects by adding this property in the .csproj :

<SonarQubeTestProject>true</SonarQubeTestProject>

It should be working then.

Mickaël

1 Like