Reputation: 461
I would like to set my PublishBuildArtifacts@1
task to run with the condition set to failed(). However, I would like to set it so that it only publishes the artifact when the test has failed three times.
- task: PublishBuildArtifacts@1
condition: failed()
inputs:
PathtoPublish: '$(System.DefaultWorkingDirectory)/$(testFolder)/$(screenshotFolder)'
ArtifactName: 'screenshots'
publishLocation: 'Container'
displayName: 'Publish Screenshots for Failed Tests'
Currently, it is publishing all failing test screenshots, even those that have passed on retry.
Upvotes: 0
Views: 337
Reputation: 1006
By my knowledge and Microsoft documentation the failed() method does not take any arguments.
You could do a for loop with the "each" keyword.
I would approach this that I save all screenshots from a given test run to separate folders based on the loop and then with some Powershell scripting and upload only the successful folder or none if all 3 runs failed.
Upvotes: 1