views:

641

answers:

2

We have setup TFS to automatically build when we checkin, that works fine.

Our problem is how do we get the unit tests to run on the server.

  1. How do we run tests on the build server?
  2. How do we automatically run SQL Scripts on the server to build the test database?
  3. Do we need to install Visual Studio on the Build Server?
  4. Do we need Visual Studio Test Edition on the client?

Thanks

Shiraz

A: 

If you want to run NUnit-Tests, you have to setup a MSBuild-Task which you include in your Build-.proj File. If you want to run the VS-Integrated Tests there are preconfigured tasks in the default Build-Script. Samples are (commented out) in your generated Build-.proj-File.

You can generally run whatever you want in your build. It's just a matter of creating the MSBuild-Tasks and integrating them into the existing build-script, which is already extensible in several locations. Describing all of MSBuild is too much to answer here. Please refer to the various Web-Sources about MSBuild.

You need to install whatever is necessary to run the tests on the Build-Machine. NUnit for NUnit-Tests, VS Test Edition for Loadtests and Webtests, and so on.

What you install on any client is of no interest for the Build-Server.

TToni
+1  A: 

Open your TeamBuildType File (TFSBuild.proj). In there you'll see a comment like the one below...

<!--  TEST ARGUMENTS
 If the RunTest property is set to true then the following test arguments will be used to run 
 tests. Tests can be run by specifying one or more test lists and/or one or more test containers.

 To run tests using test lists, add MetaDataFile items and associated TestLists here.  Paths can 
 be server paths or local paths, but server paths relative to the location of this file are highly 
 recommended:

    <MetaDataFile Include="$(BuildProjectFolderPath)/HelloWorld/HelloWorld.vsmdi">
        <TestList>BVT1;BVT2</TestList>
    </MetaDataFile>

 To run tests using test containers, add TestContainer items here:

    <TestContainer Include="$(OutDir)\HelloWorldTests.dll" />
    <TestContainer Include="$(SolutionRoot)\TestProject\WebTest1.webtest" />
    <TestContainer Include="$(SolutionRoot)\TestProject\LoadTest1.loadtest" />

 Use %2a instead of * and %3f instead of ? to prevent expansion before test assemblies are built
-->
Vanof