I have the following pipeline on azure DevOps:
name: $(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.rr)
trigger:
branches:
include:
- "*"
pool:
vmImage: "ubuntu-latest"
variables:
buildConfiguration: 'Release'
steps:
- task: SonarCloudPrepare@1
inputs:
SonarCloud: 'SonarCloud'
organization: 'edenred-ticketbenefits'
scannerMode: 'MSBuild'
projectKey: 'Edenred.Utils'
projectName: 'Edenred.Utils'
extraProperties: |
sonar.exclusions=**/obj/**,**/*.dll
sonar.cs.vstest.reportsPaths=$(Agent.TempDirectory)/**/*.trx
sonar.cs.opencover.reportsPaths=$(Agent.TempDirectory)/**/coverage.opencover.xml
sonar.verbose=true
- task: DotNetCoreCLI@2
inputs:
command: 'restore'
projects: |
**/*.sln
feedsToUse: 'select'
vstsFeed: '79f3c258-62f0-41df-9f52-8b916da9e6b8'
includeNuGetOrg: false
displayName: 'Restaurando pacotes Nuget'
- task: DotNetCoreCLI@2
displayName: 'Build da Solucao'
inputs:
command: build
projects: '**/*.sln'
arguments: '--configuration $(BuildConfiguration) --no-restore'
- task: DotNetCoreCLI@2
displayName: Test
inputs:
command: test
publishTestResults: true
projects: '**/Edenred.Utils.Tests.csproj'
arguments: '--configuration $(BuildConfiguration) --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=$(Agent.TempDirectory)/TestResults/Coverage/ --collect "Code coverage"'
- task: PublishTestResults@2
displayName: "Publish Test Results"
inputs:
testRunner: 'VSTest'
testResultsFiles: '$(Agent.TempDirectory)/**.*trx'
mergeTestResults: true
- task: SonarCloudAnalyze@1
- task: SonarCloudPublish@1
inputs:
pollingTimeoutSec: '300'
and I cant get the code coverage on the projects panel…
everything runs ok, no errors are report and yet, the code coverage does not appear… can anyone help?
EDIT 1:
After setting the path explicitly to “/home/vsts/work/_temp/coverage/coverage.opencover.xml” I can see a message on the logs stating “INFO: Parsing the OpenCover report /home/vsts/work/_temp/coverage/coverage.opencover.xml” which I think was good, but the coverage reported is still zero… there are no others warnings or errors or anything
EDIT 2:
Using the verbose logging, I was able to capture the message:
DEBUG: Gathering files for wildcardPattern ‘**/coverage.opencover.xml’.
DEBUG: Pattern matcher returns ‘1’ files.
DEBUG: The current user dir is ‘/home/vsts/work/1’.
INFO: Parsing the OpenCover report /home/vsts/work/_temp/TestResults/Coverage/coverage.opencover.xml
INFO: Adding this code coverage report to the cache for later reuse: /home/vsts/work/_temp/TestResults/Coverage/coverage.opencover.xml
DEBUG: Analyzing coverage after aggregate found ‘0’ coverage files.
DEBUG: The total number of file count statistics is ‘0’.
looking at the tests step, I saw:
A total of 1 test files matched the specified pattern.
Results File: /home/vsts/work/_temp/_fv-az52-589_2021-06-23_04_02_15.trx
Attachments:
/home/vsts/work/_temp/3561e0d9-1212-48f8-a637-123dab8fac0c/vsts_fv-az52-589_2021-06-23.04_02_12.coverage
you see? a coverage file is being generated, apparently, on the wrong path?
Has anyone ever seen something like this?