Monday, December 8, 2008

Team Build notification on test failed

A nice feature in a Continuous Integration environment is the ability to notify developers (or even managers yuk!) when a build breaks. The command Biisubscribe in TFS 2008 allows to hook up email alerts on build completion, for example this is how we can configure email notifications on build failure due to compilation errors:

bissubscribe /eventType BuildCompletionEvent /address myemail@domain.com
/deliveryType EmailPlaintext /server tfsserver1
/filter "TeamProject = 'MyTeamProject' AND CompletionStatus='Failed'

If you are running tests as a part of the build process though, you might want to take it to the next level and send notifications when any of your tests has failed. Tests are one of the most important pieces of a Continuous integration environment and as such they deserve to be taken in consideration in the notification process :)

In TFS 2008 “Failed” builds are builds that have failed during compilation time while “Partial Succeeded” builds are builds that have gone through the compilation process correctly but have failed in any of the post build actions… such as the test runner! So we have all the info needed to modify the filter from the previous command and get notifications when our tests fail :

bissubscribe /eventType BuildCompletionEvent /address myemail@domain.com
/deliveryType EmailPlaintext /server tfsserver1
/filter "TeamProject = 'MyTeamProject' AND
(CompletionStatus='Failed' OR CompletionStatus='Partially Succeeded')“

Hope this helps!

kick it on DotNetKicks.com

No comments: