@All
Please Help…
We have a .NET C# solution with some integration tests, but no unit tests. I cant able to generate code coverage…
Here is my cmd command…
dotnet restore “”
dotnet sonarscanner begin /k:"" /d:sonar.host.url="" /d:sonar.login=""
dotnet build “” -c Release -o /app/build
dotnet test “” /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
dotnet sonarscanner end /d:sonar.login=
Joe
(Joe)
March 17, 2021, 2:35pm
2
Hello Ankit,
Please see these Community Guides for assistance:
As explained in our Test Coverage documentation, SonarQube/SonarCloud does not run tests or generate reports, but imports pre-generated reports from another source. The goal of this guide is show how to troubleshoot and correct typical code coverage import issues into SonarQube/SonarCloud for C# and VB.NET languages. If you are interested in troubleshooting unit test results and execution reporting instead, see “Import unit test results” section of [Coverage & Test Data] Generate Reports for C#,…
To include test coverage in your analysis, you’ll need to:
provide the relevant analysis parameter to the SonarScanner for MSBuild begin step
execute your unit tests just after build and before the SonarScanner for MSBuild ’s end step.
We support:
Import of coverage reports from VSTest, dotCover, OpenCover, Coverlet, Altcover and NCover 3.
Import of unit test results from VSTest, NUnit and xUnit.
We’ve documented here for each engine:
what is the relevant analysis parameter to pass during…
Regards,
Joe
Thanks for quick reply…
I tried with all but cant success. with Integration Tests.
But success on Unit Test cases.
The issues was we had a written Integration test case such as like this.
.
And we need coverage this test cases.
So please help.
Hi @Ankit_Sangani
Are you passing sonar.cs.opencover.reportsPaths
to the begin command?