Create a new Build Definition using the Default Process Template in  TFS 20120.

For a complete walk through, please see:

Run Tests in Your Build Process

http://msdn.microsoft.com/en-us/library/ms253138%28v=vs.110%29.aspx

NOTE:

When you edit the Build definition, make sure to select "MSTest" to run the tests.

For more information, please see

http://msdn.microsoft.com/en-us/library/ms253138(v=vs.110).aspx#Runner_MSTest

In the Add/Edit test run dialog box, add as an additional command line argument:

 /TestContainer:C:\Builds\1\...\....\ LoadTest1.loadtest

 Also, see:

Running a Single Load Test from the Command-Line

 http://msdn.microsoft.com/en-us/library/ms182588.aspx#Single

If you get an error similar to the following:

TF270015: 'MSTest.exe' returned an unexpected exit code. Expected '0'; actual '1'. See the build logs for more details.

From the drop folder open the ActivityLog.AgentScope.1.xml.

Search for the MSTestActivity and see what arguments you are passing to MS Test.

You should see something similar to the following:

The MSTestActivity was invoked without a value for Platform or Flavor. The values Any CPU and Debug were used……………………………………………………………………

test:LoadTest1.loadtest

Invalid switch "test".

For switch syntax, type "MSTest /help"

Handle Test Run Exception00:00:00

If testException is NOT TestFailureException00:00:00

Inputs

  • Condition: True

TF270015: 'MSTest.exe' returned an unexpected exit code. Expected '0'; actual '1'. See the build logs for more details.

In the sample above, Team Build cannot find the actual  LoadTest1.loadtest.

Once you provide the correct command line arguments,
you should be able to run load tests from Team Build 2012.