The term “Build†is a complex one that does not only means “compile source files into final assembliesâ€, but it comprehends many other operations that are vital for the project. One of these operation is running unit tests during Tfs build. The reason to have unit tests run at each build is to continuously keep track of the quality of the project.
Specifying test to run in a Tfs build is really simple, since you have a specific step of the wizard dedicated to this operation.
During the definition of the build, I can simply ask to automatically detect tests in all assembly that matches the pattern *.Test.dll. Now if you schedule a build you should see results of test run. Here the first result of my test build.
Now we have a problem, because the task “running tests†is failed, but we also check that we have a “No test resultâ€, something went wrong and weare in trouble
. The most important thing to avoid when you work with Tfs is having panic
you will always get detailed error of a failing build. To look at these details, you need to look in the file BuildLog.txt located in the shared folder used by the build (in my situation is \10.0.0.200BuildsFluentMsTestBuildWithTests_20090625.3). Since the failure is due to a Test failure, I need to look for string testtoolstask (the task related to running test) to find problem related to unit testing.
Here is what I found
SBUILD : warning : Visual Studio Team System for Software Testers or Visual Studio Team System for Software Developers is required to run tests as part of a Team Build. The previous error was converted to a warning because the task was called with ContinueOnError=true. Build continuing because "ContinueOnError" on the task "TestToolsTask" is set to "true".
Ok, it seems that I forgot to install Visual Studio Team System for Software Tester in the Tfs test machine (I’m doing posts using a test virtual machine installed ex novo). Visual studio is needed, because the build is done with msbuild tool, and if visual studio is not present the build machine does not have the correct tasks to use with msbuild. Another interesting stuff is that this error states that build can continue, because the ContinueOnError of “TestToolsTask†is set to true. This is the default setting, when something goes wrong with running tests, the build does not fail, and we have a “partially succeeded†build.
Now when you install Visual Studio Team System for Software Testers on the build machine, you will finally see test result.
The interesting stuff here is that if you click on the hilighted link, you can download test results on your machine. The file you download can be opened directly from visual studio, and you can examine results as if you executed them locally.
Once again we can see that setting Tfs to run unit tests during the build is a simple process, and can be simply done with the wizard. In the next post of the series I’ll deal on more advanced configuration for test run during a build.
alk.
Tags: Team foundation Server Build






August 17th, 2009 at 3:39 am
Hi,
It would be good from you to precise which version of VSTS / TFS you’re referrring to… surely not 2005 line as it looks differen (one can only specify .vsmdi file as source of tests to be run…
August 17th, 2009 at 7:47 am
It is TFS 2008
.
Alk.
October 11th, 2009 at 3:01 pm
Hi
You need to specify the list of test to be run by specifying the .vsmdi files. Just by giving out the .dll location will not work.
Ar
October 12th, 2009 at 3:43 am
Probably you specified wrong file name, specifying the .vsmdi file is one of the option, you can simply specify the name of the dll that contains tests.
alk.
January 23rd, 2010 at 12:54 am
Nice tut!