Udostępnij za pośrednictwem


Walkthrough: Creating and Running a Load Test

In this walkthrough you create a load test, which consists of one or more Web tests.

This walkthrough steps you through creating and then running a load test using the tools of the Visual Studio Team Test suite. A load test is a container of Web tests and unit tests. You create load tests with the New Load Test Wizard. For more information about load tests, see Working with Load Tests.

A load test also exposes many run-time properties that can be modified to generate the desired load simulation. In this walkthrough, you use the load test wizard to add a Web test to a load test. For more information about Web tests, see Working with Web Tests.

This walkthrough requires an existing a Web test or several Web tests that you can add to a load test.

In this walkthrough, you will complete the following tasks:

  • Create or locate a Web application to use in a Web test.

  • Create a Web test to use in the load test.

  • Create a load test.

  • Change some of the load test settings.

  • Run a load test.

Prerequisites

  • A Web application under development. Generally, load tests that consist of Web tests are used to test a Web application that is under development and not yet ready for production. Therefore, it is assumed that you have such a Web application. Any prerequisites for the Web application are also your responsibility, such as ASP.NET, a Web Server, IIS, and any other backend data support such as Microsoft SQL Server.

    For more information, see Walkthrough: Creating a Simple Web Application.

  • Optionally, you can use a starter kit from ASP.NET Starter Kits. Follow the instructions on that site for the Setup program and any troubleshooting that might be required.

    Note

    Although a load test can contain both Web tests and unit tests, this walkthrough focuses on a load test that contains a Web test.

  • A Web test. See Walkthrough: Recording and Running a Web Test.

Prepare the Walkthrough

To prepare the walkthrough

  1. Identify the pre-production Web application that you have under development.

    Optionally, install a starter kit from ASP.NET Starter Kits. You can set this up on your local computer to run these walkthroughs.

  2. If you have not created a Web test to use for this walkthrough, see Walkthrough: Recording and Running a Web Test. The remaining steps assume a Web test named WebTest1.webtest.

Using the Load Test Wizard

Start the New Load Test Wizard

  1. Open the solution that contains your Web test, WebTest1.webtest.

    For more information, see Walkthrough: Recording and Running a Web Test.

  2. In Solution Explorer, right-click the test project node. Click Add, and then click Load Test.

  3. The New Load Test Wizard starts.

  4. The Welcome page of the New Load Test Wizard is the first page.

  5. Click Next.

Edit settings for load test scenario

  1. Type in a name for your scenario. A scenario is a grouping mechanism. It consists of a set of tests and the properties for running those tests under load.

  2. Set the Time Profile Think to Use normal distribution centered on recorded think times. Think times represent the time that a user would ponder a Web page before going on to the next page. For more information, see How to: Set Think Times in a Web Test.

  3. Click Next when you are finished.

Edit load pattern setting for test scenario

  1. Click Step load.

    Note

    You can choose from two types of load patterns: constant and step. Each type has its function in load testing, but for the purposes of this walkthrough choose Step load.

  2. Set Start user count to 10 users.

  3. Set Step duration to 10 seconds.

  4. Set Step user count to 10 users/step.

  5. Set Maximum user count to 100 users.

  6. Click Next.

Add test to a scenario

  1. The next step is to Add tests to a load test scenario and edit test mix.

  2. Click Add to select tests. Click the tests in the Available Tests pane and then click the arrow to add them to the Selected Tests pane.

  3. When you have finished adding tests, click OK.

  4. You are presented with the test mix. You can use the sliders to adjust the test distribution.

  5. After you have adjusted the sliders to your preferred mix, click Next.

Select browser mix for test scenario

  1. From the drop-down list, select the IE6 browser to add to the mix.

  2. You can add more browsers. Use the sliders to adjust the test distribution and weighting.

  3. Click Next.

Select network mix for test scenario

  1. Select the LAN connection type to add to the network bandwidth mix.

    You can add more network types. Use the sliders to adjust the test distribution and weighting.

  2. Click Next.

Specify computers to monitor with counter sets during load test run

  1. Select the computers to monitor during test runs by clicking Add Computer and type the name of the server that hosts the non-production Web site that you targeted earlier. By adding the host computer name, you gather performance information that is important in your load test.

    Note

    On each server that you monitor, you must have sufficient user permissions to run performance monitors. Otherwise, errors are generated.

    You can add a separate entry for a computer that hosts the SQL database for the site. If you choose not to add any computers, only local load counters are added to your tests.

  2. Select Counter sets that you want to monitor. A set of predefined counter sets that add specific performance monitors to your load test are displayed.

  3. Put check marks in the selection boxes for ASP.NETnet and IIS for this test if the site you are testing is runs on an ASP.NET server.

  4. Click Next.

Edit run setting for load test

  1. Set Run Duration to 2 minutes in order to smoke test your load test.

    When you build your Web tests and load tests, it is a good practice to validate that everything is correctly configured and running as expected by running a short, light load test. This process is referred to as smoke testing.

  2. Click Finish. Your Load test is opened in the Load Test Editor.

Running the Load Test

After you have created the Load test, run it to view how your Web site responds to the load simulation. While a load test is running, you see the Load Test Monitor window.

To run the Load test

  1. With a Load test open in the Load Test Editor, click the green Run button. Your load test starts to run.

  2. To maximize the viewable area, click View from Visual Studio menu, and then click Full Screen.

  3. If your test simulation exceeds any thresholds, icons appear in the tree control nodes to indicate a threshold violation. Errors have a red circle overlay, warnings have a yellow triangle overlay. You can find a counter that exceeded the threshold and graph it by dragging the icon onto the graph. This can be done while the test is running. Notice which computer it is on by observing the Computer column in the legend.

See Also

Tasks

Walkthrough: Recording and Running a Web Test

Walkthrough: Creating a Coded Web Test

Concepts

Guidelines for Smoke Testing