I was using Azure pipelines to run Unit tests and SonarQube integration. When I use cobertura for unit tests, I am unable to get code coverage results passed onto SonarQube, although I see the results in pipeline logs. However, this same thing works when I use OpenCover.
I also see this warning in pipeline logs although I am uncertain if this is related: “Missing blame information for the following files”
The pipeline currently looks as follows
- task: DotNetCoreCLI@2
inputs:
command: ‘test’
projects: |
<test-proj>
arguments: ‘/p:CollectCoverage=true /p:CoverletOutputFormat=cobertura’
displayName: ‘Run Tests’
- task: SonarQubePrepare@4
inputs:
SonarQube: <Service-Endpoint>
scannerMode: ‘MSBuild’
projectKey: ‘test:service’
projectName: ‘test:service’
extraproperties: |
sonar.flex.cobertura.reportPaths=$(Build.SourcesDirectory)/**/coverage.cobertura.xml
- task: DotNetCoreCLI@2
<Running DotNet build>
- task: SonarAnalyze@4
On running the DotNet Test stage, the test results are obtained in this path - E:\agent-5\2\s\test\ApiTest\coverage.cobertura.xml
Any suggestions would be appreciated.