In larger-scale efforts, a single machine may not have enough power to simulate the number of users you need to generate the required stress on your application. Fortunately, Team System load testing includes features supporting the execution of load tests in a distributed environment.
There are a number of roles that the machines play. Client machines are typically developer machines on which the load tests are created and selected for execution. The controller is the "headquarters" of the operation, coordinating the actions of one or more agent machines. The controller also collects the test results from each associated agent machine. The agent machines actually execute the load tests and provide details to the controller. The controller and agents are collectively referred to as a rig.
There are no requirements for the location of the application under test. Generally, the application is installed either on one or more machines either outside the rig or locally on the agent machines, but the architecture of distributed testing is flexible.
Before using controllers and agents, you must install the required Windows services on each machine. The Visual Studio 2005 Team Test Load Agent package includes setup utilities for these services.
The Team Test Load Controller Setup utility is started with setup.exe under the VS\Controller directory of the Team Test Load Agent package. This will install a Windows service for the controller and will prompt you to assign a Windows account under which that service will run. SQL Express will also be installed for data collection, but you may later configure the controller to use a different database for storage, such as SQL Server.
Install your controller and verify that the controller Windows service is running before configuring your agent machines. This will allow your agent machines to automatically register with the controller.
After the controller service has been installed, run the Team Test Load Agent Setup on each agent machine, specifying a user under whom the service should run and the name of the controller machine. The agent installation program, setup.exe, can be found in the VS\Agent directory of the package.
Once you have run the installation packages on the controller and agent machine(s), configure the controller by choosing Test Administer Test Controllers. This can be done from any machine and does not need to be done on the controller machine itself. You will see the Administer Test Controller dialog, as shown in Figure 15-26.
Type the name of a machine in the Controller field and press Enter. Ensure that the machine you specify has had the required controller services installed. The Agents panel will then list any currently configured agents for that controller, along with each agent's status.
The Load Test Results Connection String points to the repository you are using to store load test data. Click the ellipsis button to select and test a connection to your repository. If you have not already configured a repository, refer to the "Storing load test run data" section earlier in this chapter.
To add an agent, click on the Add button and specify a machine on which you've previously run the agent installation package. Temporarily suspend an agent from the rig by clicking the Offline button. Restart the agent services on a target machine with the Restart button.
You also have options for clearing temporary log data and directories as well as restarting the entire rig.
Using the Administer Test Controller dialog just described, select an agent and press the Properties button. You will be able to modify several settings, described in the following sections.
When running a distributed load test, the load test being executed by the controller has a specific user load profile. This user load is then distributed to the agent machines according to their individual weightings.
For example, suppose two agents are running under a controller that is executing a load test with 10 users. If the agents' weights are each 50, then five users will be sent to each agent.
This indicates the range of IP addresses to be used for calls from this agent to the target web application.
You may assign name-value attributes to each agent in order to later restrict which agent machines are selected to run tests. There are no restrictions on the names and values you can set.
You will learn how to leverage these attributes in the next section.
Once your controller and agents have been installed and configured, you are ready to execute a load test against them. You specify a controller for the test and agent properties in the test run configuration. You may recall seeing the test run configuration when we covered web tests.
Open your test run configuration by choosing Test Edit Test Run Configurations, and select the appropriate configuration. Then, choose the Controller and Agent entry from the left-hand list. You should see the dialog shown in Figure 15-27.
Under "Select location to run tests," choose Remote, and then enter or select the name of a valid controller machine.
You may then wish to specify restrictions for the agent machines that will run the tests. In the "Per test run restrictions" section, enter name-value pairs to qualify the agents that will be selected to run tests. For example, you could enter OS with a value of Windows 2003 Server to ensure that the tests ran only on agent machines with this matching attribute, as shown in Figure 15-27.
When you have finished making your changes, you may wish to create a new test run configuration especially for remote execution. To do so, choose Save As and specify a new file.
Now that you have installed and configured your rig (a controller and at least one agent machine) and modified your test run configuration to target the controller, you may execute the load test. Execute the test using any one of the options described in the "Executing load tests" section earlier in this chapter, ensuring that the correct test run configuration has been selected.
The controller will then be signaled to begin the test. The controller will contact the (qualifying) agent machines and distribute tests and load to each. As each test completes, the controller collects test run details from each agent. When all agents have completed, the controller finalizes the test and the test run ends.
To view the progress of your distributed load test, open the Test Runs window via the Windows option under the Test menu. You will see a window similar to the one shown in Figure 15-28.
Select the controller and press the Connect button. The window will then show details of any running, waiting, and completed runs on that controller. You may also select a run and start, stop, or temporarily suspend its execution.