Tuesday, 20 October 2015

Send Test Result Email After Running Automated Tests with Release Management

Getting automated tests executed after deployment actions, it self is challenging with release management. Below are some helpful links on “how to overcome them”.
Resolve Common Errors - Run Automated Tests with VS Release Management 2013
Disable Lock Screen on Windows 8.1 to Prevent - Automation engine is unable to playback the test because it is not able to interact with the desktop
Increase Default Timeout of Copying Test Binaries to Test Client – Allow Release Management to Run Tests with Increased Timeout
Once everything in place, with a customized TcmExec.ps1, tests get executed with RM.image
[image%255B87%255D.png]
Wouldn’t it be nice to have an email delivered to the team with the test results like shown below?6
To do this it is possible to modify the TcmExec.ps1 (How to get the TcmExec.ps1 is described here), to read the details of the test result file (.trx) and create a formatted email message to sent to the defined recipients. As the first step script is introduced with few more parameters.image
Extract the build number from the build location path given that the build path contains it.This is to make Test result email look nicer if the build number is not supplied by build TM server.image
Extract test result details into a temp table to format it for the email.image
Send email and print result in output log of RM action.image
Avoid failing the Release Management Action, even if failing tests found when the email send option is set to true. This will make sure deployment completes and the required team members are informed of the Test Results. and give them the option of proceeding or stopping the release pipeline to next steps, after evaluating test results.image
Setup a custom tool in RM using the PowerShell script TcmExec.ps1. 1
If components are already created with the tool they need to be updated with new parameters manually.2
3
Set up the release template to use the test runner with new parameters. All other common issues mentioned at the linked post in the beginning of this post.4
5
Tests are getting executed in TFS lab environment with RM. 8
Release management action output log has the details of the test printed.7
Email with the test results sent to the defined recipients.6
You can download the enhanced TcmExec.ps1 from TechNet Gallery.
https://gallery.technet.microsoft.com/Send-Test-Result-Email-5b4f0d5e