Sonarqube not covering some of the lines of code

Hi Team,

I am working on .NET Core Web API and we are using SonarQube for code quality.

The issue is SonarQube code coverage not happening on some of the lines of code which is doing validations in the controller action method

So please help on this.

Thanks

Hi,

Welcome to the community!

SonarQube only shows what’s included in your coverage reports, so it’s a question of getting those things to show up in the report you feed into SonarQube.

 
HTH,
Ann

Hi,

Thanks for your response.

You mean the validations are not covered/configured in the SonarQube report.

In my controller action method i have a validation like if the response have any errors i want to log the details. For that i have written test method but after committed the code still in the SonarQube report the validation part of action method is showing as code not covered.

Please suggest me how to write test methods for validation part of control action method

Thanks & Regards,
D G Murthy

Hi D G,

How to write tests is outside the scope of this community.

 
:woman_shrugging:
Ann