Skip to content

Instantly share code, notes, and snippets.

@Sweekriti91
Last active October 5, 2023 20:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sweekriti91/b36153e9fca43f10572f2bdbdeb74297 to your computer and use it in GitHub Desktop.
Save Sweekriti91/b36153e9fca43f10572f2bdbdeb74297 to your computer and use it in GitHub Desktop.
AzDO dotnetTest rerun yaml
trigger:
- main
pool:
vmImage: 'windows-2022'
demands:
- MSBuild
steps:
- task: DotNetCoreCLI@2
displayName: Restore NuGet Packages
inputs:
command: 'restore'
projects: 'SweekyApp.sln'
- task: DotNetCoreCLI@2
displayName: Build Test Project
inputs:
command: 'build'
projects: 'SweekyxTest\SweekyxTest.csproj'
arguments: '--configuration Debug'
- task: PowerShell@2
displayName: 'Run Unit Test Script'
inputs:
filePath: '.\test-rerun.ps1'
arguments: 'SweekyxTest/SweekyxTest.csproj -configuration "Debug" -codecoverage "XPlat Code Coverage"'
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFormat: 'VSTest'
testResultsFiles: |
**/testResults.trx
**/*.trx
# Publish code coverage report to the pipeline
- task: PublishCodeCoverageResults@1
condition: succeededOrFailed()
displayName: 'Publish code coverage'
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: $(System.DefaultWorkingDirectory)/*/*.cobertura.xml # using ** instead of * finds duplicate coverage files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment