We have a nightly scheduled pipeline that runs tests and publishes the results to a test run. We can see the the url to the test run as this is generated by the PublishTestResults@2 task. I'd like to extend this functionality by emailing a set of users the devops link to the test run.
Here's how the publish task currently looks:
steps:
# Publish test results (to show the test details in JUnit format)
- task: PublishTestResults@2
displayName: 'Publish test results'
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '*.xml'
searchFolder: '$(Build.SourcesDirectory)/cypress/reports/junit'
mergeTestResults: true
testRunTitle: 'Publish Test Results'
condition: succeededOrFailed()
continueOnError: true
Are there any recommended approaches to doing this?
If you just need a link to the pipeline run itself, you can configure a notification.
If you want more control than notifications offer the Email Report Extension from Microsoft DevLabs generates (a customizable) report sent to a list of recipients that contains:
- Overall Test Summary : This info mirrors the Test Tab in the Pipeline.
- Test Run Summary: Information about individual test runs happened in the Pipeline if any.
- Test Failures: Shows Test Failures, their stack traces (Configurable in the Task Input) and associated workitems.
- Commits/Changeset Information
- Phases/Environments Information
- Task information: Task(s) that ran in the pipeline - Name, Duration and any error logs if failed.
You will need to provide credentials for the smtp server the email should be sent through
There is a number of 3rd party email sending extensions for Azure DevOps,
There is of course also the option to create a bash/powershell script to send the email, here is a simple Powershell Example: How to send email with PowerShell