Last active
August 19, 2021 14:46
-
-
Save pritpalp/ccdb68a940701ef4e0e7f2831e2aeb14 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- script: "dotnet add package coverlet.collector" | |
displayName: 'Install the coverlet collector' | |
- script: "dotnet tool install dotnet-reportgenerator-globaltool --global" | |
displayName: 'Install the report generator tool' | |
- script: dotnet test UnitTests/UnitTests.csproj --logger "trx;LogFileName=testresults.trx" --collect:"XPlat Code Coverage" && reportgenerator "-reports:UnitTests/TestResults/*/coverage.cobertura.xml" "-targetDir:UnitTests/TestResults/Coverage/Reports" -tag:$(Build.BuildNumber) -reportTypes:htmlInline | |
workingDirectory: UnitTests | |
displayName: 'Run dotnet test and ReportGenerator on results' | |
- task: PublishTestResults@2 | |
inputs: | |
testResultsFormat: 'VSTest' | |
testResultsFiles: '**/testresults.trx' | |
searchFolder: 'UnitTests' | |
failTaskOnFailedTests: true | |
- task: PublishCodeCoverageResults@1 | |
inputs: | |
codeCoverageTool: 'Cobertura' | |
summaryFileLocation: 'UnitTests/TestResults/*/coverage.cobertura.xml' | |
reportDirectory: 'UnitTests/TestResults/Coverage/Reports' | |
failIfCoverageEmpty: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment