This title is purposely misleading. Rather it should be how to get Visual Studio 2012 unit tests to run with TFS Build Server 2010. However this is the result of not completely configuring my build environment as outlined in the remaining text below…
Have you ever created a TFS 2010/2012 Build definition, and tried to make sure that unit tests were executing correctly, only to check it and notice that the Unit Tests were not quite executing, yet TFS Build server displayed it was. To make matters worse, the unit tests were never ending, and the TFS Build was sitting there waiting for the test to end. To top it off, these builds were “Gated” check in builds, which basically meant no one could check in their code successfully until the build completed successfully, which in my case wasn’t happening because the unit test never completed, heck they never truly started.
You tried everything and not once did it occur to you that you were running Visual Studio .Net 2012 unit tests with TFS Build Server 2010. TFS Build Server 2010 is designed to work with Visual Studio .Net 2010. Even though it will work woth VS.Net 2012, TFS Build Server 2010 knows nothing about VS.Net 2012, including it’s unit tests.
So… I searched… http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/ab53380d-36fd-40e5-8494-3cb9560578b5 and I asked http://social.msdn.microsoft.com/Forums/en-US/tfsbuild/thread/252f96cd-4b67-4075-ba82-57aa322f69ec
Luckily, one of the MS TFS Experts: John Qiao, pointed me in the right direction and gave me the answer…
First thing I had to do was to create a new Build Process template based on the default template, so that I would mess up any default settings and build definitions.
Next thing I had to do was modify the section which invokes the Unit Testing engine: MSTest.
Which was easy enough, just open up the Custom template I created, which just happens to be a WF 4.0. Navigate to the Run MSTest for Test xxx, activity, and modify it’s ToolPath property settings:
That was it… My Visual Studio 2012 Unit Tests were executing in TFS Build Server 2010 successfully… (BTW, I know my path is mis-spelled, when installing VS.Net it was manually configured and typed in wrong… I didn’t do it- promise J)