Walkthrough: Recording and Running a Web Performance Test
In this walkthrough, you’ll use the tools of Visual Studio Ultimate to create a Web performance test from a browser recording and verify that it works correctly.
To create the Web performance test, you’ll record a browser session. The browser session is then displayed as a list of URLs in the Web Performance Test Editor. Each URL represents a Web request. For more information about Web performance tests, see Creating and Editing Web Performance Tests.
You’ll perform the following tasks:
Create a Web performance and load test project
Create a Web performance test from a browser recording
Run the Web performance test to verify that it works correctly
Prerequisites
Here’s what you’ll need:
Visual Studio Ultimate
The Web app that you created in Walkthrough: Creating a Simple Web App
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 App, but you will need the address of the application.
To prepare for the walkthrough
Open the Web app that you created in Walkthrough: Creating a Simple Web App.
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.
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
Close the browser.
Creating a Web Performance and Load Test Project
To create the Web performance and load test project
On the FILE menu, point to Add and then choose New Project.
The Add New Project dialog box appears.
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.
In the list of templates, choose Web Performance and Load Test Project.
In the Name box, type ColorWebAppTest.
In the Location box, type the name of the folder where you saved your Web app. For example, type the folder name C:\Users\<user name>\Documents\Visual Studio 11\Projects\ColorWebApp. You can also use the Browse button to locate the folder.
Choose OK.
The ColorWebAppTest project is added to your solution, which includes a Web performance test named WebTest1.webtest
In Solution Explorer, select WebTest1.webtest and open the shortcut menu. Choose Rename and change the name of the Web performance test to ColorWebTest.webtest.
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
In Solution Explorer, select ColorWebTest.webtest, open the shortcut menu, and then choose Open.
The Web Performance Test Editor displays for ColorWebTest.
In the Web Performance Test Editor, choose Add Recording from the toolbar.
Your web browser opens with the Web Test Recorder add-on displayed.
Note
If you don’t see the Web Test Recorder, you must configure the add-ons in your web browser to include it.
Warning
For the next procedure to work correctly, you must follow these steps in the order shown.
In the browser's address bar, type the address of the Web application that you copied in a previous step, and choose ENTER.
Note
Visual Studio Ultimate begins to display the Web performance test URLs in the Web Performance Test Recorder as it is recording.
Choose Red and choose Submit. The page with the Label that says Red should be displayed.
Go back to the first page.
Choose Blue and choose Submit. The page with the Label that says Blue should be displayed.
Go back to the first page.
Choose 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 select 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 will see your Web performance test in the Web Performance Test Editor as a list of URLs. You can now edit the test.
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. Select various nodes in the request tree to view the properties associated with each request.
To view and modify request properties
In the Web Performance Test Editor, go to the request tree and select the first instance of https://localhost:<PortNumber>/Default.aspx .
In the Properties window, note the values of the different properties, for example URL, Follow Redirects and Think Time.
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 Red and chose 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.
On the toolbar, choose 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.
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.
Choose OK.
In the request tree, expand the second instance of https://localhost:<PortNumber>/Default.aspx.
Expand the Form Post Parameters folder.
Notice that this request occurred after you selected blue and chose the submit button in the RadioButtonList1 and Button1 post parameters.
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.
In the Properties window, select the text box next to Reporting Name and type Red.
Highlight the request node for the fourth instance of http:// localhost:<PortNumber>/Default.aspx.
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.
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
In the Web Performance Test Editor, choose 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.
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 websites 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.
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.
To run your test a second time, choose 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:
To add data binding to the ColorWebTest.webtest created in this walkthrough, see Walkthrough: Adding Data Binding to a Web Performance Test.
To add validation and extraction rules to the ColorWebTest.webtest created in this walkthrough, see Walkthrough: Adding Validation and Extraction Rules to a Web Performance Test.
To conduct stress testing against the ColorWebTest.webtest created in this test, you can perform the steps in Walkthrough: Creating and Running a Load Test Containing Web Performance Tests.
To configure the ColorWebTest.webtest created in this walkthrough for testing across multiple machines using a test controller and test agents, you can perform the steps in Walkthrough: Creating and Running a Load Test Containing Web Performance Tests first and then perform the steps in Walkthrough: Using a Test Controller and Test Agents in a Load Test.
To learn how to convert the ColorWebTest.webtest created in this walkthrough to a coded Web performance test, see Walkthrough: Creating a Coded Web Performance Test.
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 App
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