Share via


Walkthrough: Recording and Running a Web Performance Test

In this walkthrough, you will create a Web performance test from a browser recording and verify that it works correctly.

This walkthrough steps you through the creation and running of a Web performance test using the tools of Visual Studio Ultimate. You create a Web performance test by recording a browser session which is then displayed as a list of URLs, representing Web requests, in the Web Performance Test Editor. . For more information about Web performance tests, see Creating and Editing Web Performance Tests.

In this walkthrough, you will perform the following tasks:

  • Create a test project

  • Create a Web performance test from a browser recording

  • Run the Web performance test to verify that it works correctly

Prerequisites

To complete this walkthrough, you need the following:

Preparing for the Walkthrough

For this walkthrough you will not make any changes to the Web application that you created in Walkthrough: Creating a Simple Web Application, but you will need the address of the application.

To prepare for the walkthrough

  1. Open the Web application that you created in Walkthrough: Creating a Simple Web Application.

  2. Press CTRL+F5 to run the Web application in the browser. You should see the first page.

    Note

    This starts the ASP.NET Development Server that runs the Web application your Web performance test will test. You will see the ASP.NET Development Server icon in the notification area, on the right side of the taskbar.

  3. Copy the address of your Web application to the clipboard or a notepad file. For example, the address might look like this: https://localhost:<PortNumber>/ColorWebApp/Default.aspx

  4. Close the browser.

Creating a Test Project

To create the test project

  1. On the File menu, point to Add and then click New Project.

    The Add New Project dialog box appears.

  2. Under Installed Templates, expand Visual Basic or Visual C# according to your preference, and select Test.

    Note

    You will not write any code in this walkthrough. The language that you choose for your project affects the language that is used when coded Web performance tests are generated.

  3. In the list of templates, choose Test Project.

  4. In the Name box, type ColorWebAppTest.

  5. In the Location box, type the name of the folder where you saved your Web application. For example, type the folder name C:\Users\<user name>\Documents\Visual Studio 2010\Projects\ColorWebApp. You can also use the Browse button to locate the folder.

  6. Clear the Create directory for solution check box.

  7. Click OK.

    Note

    By default, Visual Studio 2010 Ultimate will add a unit test file. You will not need the unit test file for this walkthrough. Therefore you can delete the file. If you do not delete the file, it will not affect the walkthrough.

Recording a Web Performance Test

You record a Web performance test by browsing a Web site as if you were the end-user. As you move through the site, requests are recorded and added to the Web performance test. For more information about how to record a Web performance test, see How to: Create a New Web Performance Test Using the Web Performance Test Recorder.

To record the Web performance test

  1. On the Test menu, click New Test.

    The Add New Test dialog box appears.

  2. In the Add New Test dialog box, select Web Performance Test, name the test ColorWebTest.webtest, and then click OK.

    A new Web performance test file that is named ColorWebTest.webtest is added to your project, and the Web Performance Test Recorder opens inside a new instance of Internet Explorer.

    Warning

    For the next procedure to work correctly, you must to follow these steps in the order shown.

  3. In the browser's address bar, type the address of the Web application that you copied in a previous step, and press ENTER.

    Note

    Visual Studio 2010 Ultimate begins to display the Web performance test URLs in the Web Performance Test Recorder as it is recording.

  4. Choose Red and click Submit; the page with the Label that says Red should be displayed.

  5. Go back to the first page.

  6. Choose Blue and click Submit; the page with the Label that says Blue should be displayed.

  7. Go back to the first page.

  8. Click Stop on the Web Performance Test Recorder to stop recording.

    A dialog box displays the message Detecting dynamic parameters. It also displays a progress bar that shows the status of parameter detection in the HTTP responses that were received.

    Because the ColorWebApp does not have any dynamic parameters, the dialog box displays the message Did not detect any dynamic parameters to promote. The dialog box then closes.

    Note

    If dynamic parameters were detected, the Promote Dynamic Parameters to Web Test Parameters dialog box would appear allowing you to check boxes for the promotions that you want to apply when you run the Web performance test. For more information, see How to: Resolve Web Performance Test Playback Issues Caused by Dynamic Parameters.

    Now that Web performance test recording has ended, you can see your Web performance test in the Web Performance Test Editor as a list of URLs. You can now edit the test.

  9. Choose File and then choose Save ColorWebTest.webtest to save the newly recorded Web performance test.

Viewing and Modifying Request Properties

The tree of URLs in the Web Performance Test Editor is called the request tree. You can select various nodes in the request tree to view the properties associated with each request.

To view and modify request properties

  1. In the Web Performance Test Editor, go to the request tree and select the first instance of https://localhost:<PortNumber>/Default.aspx .

  2. In the Properties window, note the values of the different properties, for example URL, Follow Redirects and Think Time.

  3. Notice that Think Time for this request is a number greater than 0. This is how many seconds the default page waited until you selected Blue and clicked submit in step 4 of the previous procedure.

    For more information, see How to: Set Think Times to Simulate Human Pausing in a Web Performance Test.

  4. On the toolbar, click Set Request Details.

    The Request Details dialog box appears. This dialog box lets you review and edit all the think times for the various Web requests in the Web performance test.

  5. In the Think Time column, select each request with a think time value greater than 0 and change it to 1. This allows the test to play back with minimum delay caused by human interaction.

    For more information, see How to: Set Request Details in a Web Performance Test.

  6. Click OK.

  7. In the request tree, expand the second instance of https://localhost:<PortNumber>/Default.aspx.

  8. Expand the Form Post Parameters folder.

    Notice that this request occurred after you selected blue and clicked the submit button in the RadioButtonList1 and Button1 post parameters.

  9. Highlight the request node for the same second instance of http:// localhost:<PortNumber>/Default.aspx request with the red and submit post parameters and view the Expected response property in the Properties window to help identify the request.

  10. In the Properties window, select the text box next to Reporting Name and type Red.

  11. Highlight the request node for the fourth instance of http:// localhost:<PortNumber>/Default.aspx.

  12. In the Properties window, select the text box next to the Reporting Name property and type Blue.

    Using the Reporting Name property will make it much easier to identify requests in the Web Performance Test Analyzer when it is run in the next procedure. Reporting names also make it easier for stakeholders to identify requests in reports.

    For more information, see How to: Use Reporting Names to Easily Identify Requests in a Web Performance Test and How to: Create Load Test Performance Reports Using Microsoft Excel.

  13. Choose File and then choose Save ColorWebTest.webtest to save the newly recorded Web performance test.

    To learn more about modifying web requests and Web performance tests, see Customizing Web Performance Test Recordings Using Web Performance Test Editor.

Running the Web Performance Test to Verify that it Works Correctly

You can now run the Web performance test to verify it that it works correctly. Each Web request that you recorded will be replayed, and the results will be collected. For more information, see Running Web Performance Tests.

To verify the Web performance test

  1. In the Web Performance Test Editor, click Run Test on the toolbar.

    The test starts to run, and a session of the Web Performance Test Results Viewer displays each request in the test. The Test Results window displays the result for the entire test. Next, you will verify the results.

  2. In the Web Performance Test Results Viewer select the first request in the list.

    You should see a green check mark to the left of the request. A green check mark indicates that the request succeeded. You should see the first page of the Web application in the bottom pane.

    You will see either a green check mark or a red X to the left of the request. A red X indicates that the request failed. This will cause the result for the entire test to fail, after the test has finished. By default, if a request fails, the rest of the test is not aborted and does continue. For example, an external Web request might fail because of firewall problem. However, the next request will still be attempted and the test will continue to run.

    Tip

    If you cannot access Web sites outside your local network, you might have to specify a proxy server in your Web performance test. For more information on firewall issues, see How to: Specify a Proxy Server for a Web Performance Test.

  3. Notice how easily recognizable the two request called Red and Blue are using the Reporting Name assigned in the previous procedure. If they had not been used, each request would be identically named.

  4. To run your test a second time, click Click here to run again at the top of the Web Performance Test Results Viewer.

Next Steps

In this walkthrough you recorded and ran a Web performance test. Now that you have a Web performance test, you can add either of the following enhancements, if they are needed:

See Also

Tasks

How to: Use Reporting Names to Easily Identify Requests in a Web Performance Test

How to: Create a New Web Performance Test Using the Web Performance Test Recorder

How to: Set Think Times to Simulate Human Pausing in a Web Performance Test

How to: Set Request Details in a Web Performance Test

Walkthrough: Creating a Simple Web Application

Walkthrough: Adding Data Binding to a Web Performance Test

Walkthrough: Adding Validation and Extraction Rules to a Web Performance Test

Walkthrough: Creating a Coded Web Performance Test

How to: Create Load Test Performance Reports Using Microsoft Excel

Reference

Web Performance Test Editor Overview

Other Resources

Customizing Web Performance Test Recordings Using Web Performance Test Editor