We are using Nunit for unit testing and NSubstitute for mocking for our asp.net core 8 project.
While running the test locally we are able to get the results. Which shows me coverage and also in the tests folder we have coverage.opencover.xml file available.
Coming to azure pipeline we have below steps, we are in classic pipelines.
Pipeline configuration steps:
I) Visual studio test performer installer.
II) prepare of analysis on sonarqube: we have selected choosen way to run analysis is :
- selected for Integrate with MS build.
- Project.key and project.name and project versions are avail along there.
- in additional properties: we have sonar exclusions and
- sonar.cs.vstest.reportPaths as
$(Agent.TempDorectory)\*.TRX sonar.cs.opencover.reportPaths=$(Build.SourceDirectory)\**\coverage.opencover.xml
In one step : We are doing copy of app setting In another step we have build step as well then it comes to.
Test step: path to project is given**/*[Tt]test/**/*.csproj
Arguments we have:--configuration$(build configuration) /p:Collect coverage=true /p:CoverletOutputFormat=opencover /p:ParallelizeTestCollections= true
Run code analysis having - use built-in java home 17*64
Step: We have publish quality gate result step
Step: We have publish code coverage step where we have:
Display name as, publish code coverage from$(Common.TestResultsDirectory)/*.cobertura.xml
Code coverage tool: cobertura
Summary file:$(Common.TestResultsDirectory)/*.cobertura.xml
Step: Last Publish symbol path: path to symbol folder$(Build.SourcesDirectory) search pattern **\bin\**\*.pdb
We are not able to show any code coverage in local we are able to generate file same in pipeline also we can see the results but sonarqube shows 0.
In .csproj of unit test we have references even for coverlet.msbuild, coverlet.collector, and others.
Any leads will be highly appreciated, tha ks in advance.