Please clarify if we really need at least one unit test project if we want to work with Sonarqube?

Hi Team,

I’m using Sonarqube Community Edition hosted on an Azure container instance and I’m using it in my .net core api applications, all working fine.

There is a case where developers don’t create any unit test projects for their .net core api application. Is there a way to generate code coverage report, code smells & bugs reports without using any unit test project.

I created Sonarqube project key for .net core api application and configured it in my azure devops yaml pipeline by passing .net core api application .csproj file as input to Sonarqube.

Could you please clarify if we really need at least one unit test project if we want to work with Sonarqube?

Please see below screen shot I am getting below error while doing Run Code Analysis step

  • task: SonarQubeAnalyze@5
    displayName: ‘Run Code Analysis’

Your help is highly appreciated.

Hello,

I confirm that you can use SonarQube CE or any Editions without Unit Test projects. You won’t get any coverage data but it’s OK, everyone needs to start at some point. You will get only static analysis of your C# code.

The listed possible causes on line 28+ are things you should consider. It is very important to execute the scan in 3 steps for DotNet projects: begin, build, and end phase. Here is the documentation.

Alex

Hi @Alexandre_Gigleux

Thank you for your reply.