How to automatically run a load test as part of a build


· A machine (VM or physical) to host the test rig components: test controller and agent (from now on this machine will be referred as CONTROLLER).

· A SQL database to hold the load test results (from now on this machine will be referred as SQL).

· An account with admin rights in CONTROLLER (from now this account will be referred as the CONTROLLER ACCOUNT).

· A visual studio solution with a load test.

· The installer for the visual studio agents (this includes installer for the Test Controller and the Test Agent)

Configuration of the test rig

Detailed information on how to do this can be found in this MSDN article. The following steps are a walkthrough summary to configure a one machine rig (test controller and test agent on the same machine):

1. Install the test controller service on the CONTROLLER machine

2. Configure the controller service to running load tests

  • a. Open Test Controller configuration tool
  • b. Enter the CONTROLLER ACCOUNT username and password
  • c. In the “Load Testing” section, select the “Configure test controller for load testing” checkmark
  • d. Enter the name of the SQL machine
  • e. Click on apply settings.


3. Install the test agent service on the CONTROLLER machine

4. Configure the test agent to run load tests, register the agent with the controller

a. Open Test Agent configuration tool

b. Enter the CONTROLLER ACCOUNT user name and password

c. Select the “Register with Test Controller” checkmark

d. Enter the name of CONTROLLER machine followed by a colon and the port of the controller service (default of 6901).


Configuration of Build machine

5. Install Visual Studio Ultimate on the build machine.

6. Ensure the Build service identity has administrator rights in the CONTROLLER machine

Configuration of Visual Studio solution

7. Open the solution that contains the load test

8. Right click at the solution level and select “Add-> new item”. Add a new test settings file

9. Open the test setting file, go to the “Roles” section (left hand side) and in the “Test Execution Method” select “Remote Execution.

10. In the “Controller” text box type the name of the CONTROLLER machine

11. Apply changes, exit, and check in the solution changes.


Configuration of Build Definition

12. Open the build definition, and navigate to the “Process” section

13. In the "Build Process Parameters” expand the “Basic” step, expand “Automated Tests”,

14. Open the “Test Assembly” configuration dialog

a. Select “MSTest.exe Runner” as the Test Runner

b. In the “Test assembly file specification” text box enter the name and location of the load test to execute relative to the drop location (e.g. if your load test is not nested in a folder, then you would only type <nameofloadtest>.loadtest, if the test is nested in a folder then you would type <foldername>\<loadtestname>.loadtest)

i. Note: Keep in mind that, unlike Unit tests and Coded UI tests, load test are not contained within an assembly. Therefore you should NOT select the output assembly of the test project in this field. Instead you need to point the runner to the .loadtest file

c. In the “Test Settings file” section click on the browse button and select the test settings file that you created in the previous section (if you cannot find it, make sure you checked in the file).

15. Save the build


Now you are ready to run the build and have the load test automatically executed.

Comments (0)

Skip to main content