Geeks With Blogs

Tim Huffam Dotting the I and crossing the T of I.T.

The following will make your builds (running on a TFS Server) execute your unit tests after the build:

  1. Open your build file (eg TFSBuild.proj).  VS2008 has a nice xml editor for this.
  2. Search for the RunTest node and change it from:
    <RunTest>false</RunTest>
    to:
    <RunTest>true</RunTest>
  3. Look for a section that starts with:
    <ItemGroup>
    <!--
    TEST ARGUMENTS ...
    and add nodes within this (after the comments and before the closing of the ItemGroup node) - one entry for each unit test assembly you have eg:
    <TestContainer Include="$(OutDir)\My.App.UnitTests.dll" />

Thats it - check in this file and queue a build.

An error I got while getting this working indicated that the MSTest.exe could not be found - this was because TFS Client had not been installed on the build server - once these were installed it worked fine.

Something else you may want to do is ensure that a build is triggered every time someone checks in.  To do this, edit your build definition (right click on your build within Team Explorer and choose "Edit Build Definition...") - click on the 'Trigger' item in the list on the left and make sure the "Build each check-in (more builds)" item is checked.

HTH
Tim

Posted on Tuesday, June 16, 2009 10:54 PM BizTalk , C# .NET , ASP.NET , Unit Testing , Dev Env, TFS, MSBuild etc | Back to top


Comments on this post: How to turn on unit testing in your TFS build

# re: How to turn on unit testing in your TFS build
Requesting Gravatar...
Interesting post and thanks for sharing. Some things in here I have not thought about before.Thanks for making such a cool post which is really very well written.will be referring a lot of friends about this.Keep blogging
Left by squidoo lens creation seo on Jan 25, 2011 8:19 AM

# re: How to turn on unit testing in your TFS build
Requesting Gravatar...
Finally found what I was looking for! Thanks man!
Left by free drawing software on Apr 04, 2011 3:03 AM

# cuteamisha
Requesting Gravatar...
Thanks for everything you do on this blog. international flower delivery switzerland
Left by international flower delivery sw on May 25, 2011 2:42 AM

# Loan
Requesting Gravatar...
I got while getting this working indicated that the MSTest.exe could not be found - this was because TFS Client had not been installed on the build server - once these were installed it worked fine.
Left by Payday Loan on Oct 20, 2011 4:48 AM

# Android app developers
Requesting Gravatar...
Your informational post is great resource for lots of peoples. so thanks for creating this interesting blog.
Left by Android app developer on Nov 24, 2011 1:26 AM

# re: How to turn on unit testing in your TFS build
Requesting Gravatar...
It is nice of you to post this.I will pay more attention on it.replica women Burberry Highheel shoes from China for sale on line
Left by Cheapbagshopping.com on Nov 25, 2011 8:16 AM

# re: How to turn on unit testing in your TFS build
Requesting Gravatar...
I seriously desired doing so a whole lot. cya substantially for the purpose of showing. Page comprehend a good number of involving whatever you decide to assert here. Continue. Sustain producing.
Left by Nandroid Backup on Apr 10, 2012 4:45 PM

# re: How to turn on unit testing in your TFS build
Requesting Gravatar...
hanks for making such a cool post which is really very well written
Left by giầy nam on Dec 13, 2012 8:38 AM

# Mr
Requesting Gravatar...
Something else you may want to do is ensure that a build is triggered every time someone checks in. To do this, edit your build definition (right click on your build within Team Explorer and choose "Edit Build Definition...") - click on the 'Trigger' item in the list on the left and make sure the "Build each check-in (more builds)" item is checked.oneholiday.de
Left by Rdnnis Dgefb on Jan 17, 2013 2:38 PM

Your comment:
 (will show your gravatar)


Copyright © Tim Huffam | Powered by: GeeksWithBlogs.net