diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 86be457..0099877 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -36,38 +36,35 @@ steps: # Run all tests with "/p:CollectCoverage=true /p:CoverletOutputFormat=cobertura" to generate the code coverage file - task: DotNetCoreCLI@2 - displayName: Test + displayName: dotnet test inputs: command: test - arguments: '--configuration $(BuildConfiguration) /p:CollectCoverage=true --collect:"XPlat Code Coverage"' + arguments: '--configuration $(BuildConfiguration) --logger trx --collect:"XPlat Code Coverage"' projects: '$(solution)' nobuild: true + publishTestResults: false continueOnError: true - # Generate the report using ReportGenerator (https://github.com/danielpalme/ReportGenerator) -# First install the tool on the machine, then run it -- script: | - dotnet tool install -g dotnet-reportgenerator-globaltool - reportgenerator -reports:$(Agent.TempDirectory)/**/coverage.cobertura.xml -targetdir:$(Build.SourcesDirectory)/CodeCoverage -reporttypes:Cobertura - displayName: Create Code coverage report +- task: reportgenerator@4 + inputs: + reports: '$(Build.SourcesDirectory)/**/coverage.cobertura.xml' + targetdir: 'coveragereport' + sourcedirs: '$(Build.SourcesDirectory)' -# Publish the code coverage result (summary and web site) -# The summary allows to view the coverage percentage in the summary tab -# The web site allows to view which lines are covered directly in Azure Pipeline - task: PublishCodeCoverageResults@1 displayName: 'Publish code coverage' inputs: codeCoverageTool: Cobertura - summaryFileLocation: '$(Build.SourcesDirectory)/CodeCoverage/Cobertura.xml' - pathToSources: '$(Build.SourcesDirectory)' + summaryFileLocation: '$(Build.SourcesDirectory)/coveragereport/Cobertura.xml' + reportDirectory: '$(Build.SourcesDirectory)/coveragereport' - task: PublishTestResults@2 inputs: testResultsFormat: 'VSTest' - testResultsFiles: '$(Agent.TempDirectory)/**/coverage.cobertura.xml' + testResultsFiles: '**/*.trx' mergeTestResults: true failTaskOnFailedTests: true - + - task: DotNetCoreCLI@2 inputs: command: publish