Visual Studio Team System
How to: Record a Web Test

You record a Web test by creating a new Web test in Visual Studio. The Web test launches Internet Explorer, activating the integrated Web Test Recorder. The Web Test Recorder is installed as part of Visual Studio Team Edition for Testers; it is used to record the actions you perform while you browse a Web site. As you move through the site, recorded requests are added to the Web test.

After you have recorded a Web test, you can change the test and add properties to the test by using the Web Test Editor. For more information, see How to: Edit an Existing Web Test. You cannot edit your Web tests until recording is stopped.

The Web Test Recorder does not capture traffic sent between the client and server. This type of tool is sometimes called proxy recorder. Because of this, dependent requests, such as images, CSS, and JavaScript, are not recorded. Instead, the Web Test Viewer determines dependent requests at run time. This leads to a more resilient test that is not cluttered with requests for images. If your site issues request through JavaScript code, you must manually add these request to the recorded web test after recording.

Recording a Web Test

To record a Web test

  1. Open a Test project. For more information about how to create a test project, see How to: Create a Test Project.

  2. On the Test menu, click New Test.

    The Add New Test dialog box is displayed.

  3. Select Web Test.

  4. In the Test Name box, type an appropriate name. Do not change the .webtest extension. When you are finished, click OK.

    The Web Test Recorder opens inside a new instance of Internet Explorer.

  5. Go to the site you want to test, generally a non-production Web site, and observe the URLs that are listed in the Web Test Recorder.

    NoteNote

    Typically, 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.

  6. (Optional) Click more links to record additional pages.

    Visual Studio displays the recorded Web test in the Web Test Editor as it is being recorded. After you stop the recording, you can edit the test.

  7. Click Stop to stop recording and close Internet Explorer.

  8. On the File menu, click Save to save the newly recorded Web test.

Request Properties

The tree of nodes that contains URLs in the Web Test Editor is called the request tree. You can select nodes in the request tree to view the properties associated with each request after the test is recorded.

Note the following about the requests that are captured:

  • The Query String parameters and the Form Post Parameters were detected and automatically generated into the test. You can view the transport method property, GET or POST in the Visual Studio Properties window for each request of a Web test.

  • When recording is finished, the Web Test Recorder automatically detects the use of hidden form fields. You can add an ExtractHiddenFields extraction rule to a request that contains hidden fields. The extraction rule will capture the hidden field values in the context of the Web test. The hidden field values that were sent back to the Web server can be replaced with content-binding to those context parameters. This allows the test to use the correct hidden field values at runtime which is necessary for hidden fields that contain unique identifiers including VIEWSTATE. For more information, see How to: Add an Extraction Rule to a Web Test.

    For more information about view state, see Understanding ASP.NET View State.

  • Images are not recorded. Instead, because the Parse Dependent Links property of the request is set to True, the page is parsed to determine the set of dependent requests on the page, such as images, CSS, and JavaScript. For more information, see How to: Edit an Existing Web Test.

  • Redirects are not recorded. Redirects are followed automatically when the test is run.

See Also

Tags :


Community Content

bpatel7
Recording web tests for sites that use Ajax

If your site uses Ajax, the web test recorder will not see the Ajax requests. llk

In order to record web tests on sites that use Ajax, download and install fiddler (http://www.FiddlerTool/Fiddler). My suggestion is to have the web test recorder going, and also record your session in fiddler. Fiddler will capture all of the traffic, and the newest version will even save the requests out as a web test.

Once I have the fiddler requests saved as a web test, I will open the fiddler test, and copy only the Ajax requests over into the web test I recorded through Visual Studio. Once you have the requests integrated with your recorded web test, you can edit and run the web test normally.

Tags :

EricLaw-MSFT
Ajax and SSL
There is currently no way to record Ajax requests over an SSL connection. You can use fiddler to identify that there are Ajax requests being made, but you cannot see the body of the requests in fiddler. For this version of Visual Studio Team System, the suggested workaround is to temporarily disable SSL, while you record your test. After the test is recorded, you can enable SSL again, and the test will work properly.

Update: Current versions of Fiddler (Fiddler 2.0+) offer a "Decrypt HTTPS Traffic" option.
Tags :

alex_f
Recording Web tests for sites that use AJAX
For functional and unit testing of Web applications I can recommend SWExplorerAutomation (SWEA) from http://www.webiussoft.com  SWEA records, replays and generates C# or VB.NET test script code. SWEA was specially designed to support AJAX Web applications.
Tags :

evalid_srinc
Recording Web tests for sites that use AJAX

Unlike other products that are wrappers or proxy's or "passive taps on the HTTP/S traffic." eValid is built as a full-featured browser based on the IE resident DLLs (this means that eValid browses and renders pages exactly like IE). This architecture gives eValid great advantages at performing the critical testing functions needed in the real world. Full details about the eValid web analysis and testing suite can be found by downloading and installing from:

(http://www.e-valid.com/Products/Download.7/down.evalid.7.phtml?status=FORM)

Tags :

yOO-NosOy
Recording Web tests for sites that use XmlHttpRequest and/or AJAX

If your site uses XmlHttpRequest, the Visual Studio test recorder will not be aware of those calls.

As said above, you can download and install fiddle http://www.FiddlerTool/Fiddler to record calls made through XmlHttpRequest and AJAX (which internally uses XmlHttpRequest as communication mechanism).


Frederic Torres
Functional Web Test Recording
InCisif.net 2.0 has a record mode worth trying which is integrated with Visual Studio. See their main screencast.

Page view tracker