How to: Add an Extraction Rule to a Web Performance Test

This topic applies to:

Visual Studio Ultimate

Visual Studio Premium

Visual Studio Professional 

Visual Studio Express

Topic applies Topic does not apply Topic does not apply Topic does not apply

Extraction rules help verify that a Web application is working correctly by extracting data from the responses to Web requests. Extraction rules store results in the test context as name value pairs. Extraction rules can extract form fields, text, attributes, headers, regular expressions, and hidden fields. For more information, see Using Validation and Extraction Rules in Web Performance Tests.

You add extraction rules to Web performance tests in the Web Performance Test Editor. For more information about opening and editing a Web performance test, see How to: Edit an Existing Web Performance Test Using the Web Performance Test Editor.

Procedure

To add an extraction rule to a Web performance test

  1. Open a Web performance test.

    For more information about how to create a Web performance test, see Creating and Editing Web Performance Tests.

  2. In the Web Performance Test Editor, select the request to which you want to add the extraction rule.

  3. Right-click the request and select Add Extraction Rule.

    The Add Extraction Rule dialog box is displayed.

  4. In the Add Extraction Rule dialog box, in the Select a rule pane, select a rule to configure. For example, select Extract Attribute Value. For information about other predefined extraction rules, see Using Validation and Extraction Rules in Web Performance Tests.

  5. In the Properties for selected rule pane, set the Context Parameter Name property to a descriptive name such as FirstLink. When the extraction rule runs, a context variable named FirstLink is created that contains the extracted string.

  6. Set the Attribute Name property to href and the TagName property to a.

    Note

    The HTML format of what we are trying to extract in this example is <a href=http://www.contoso.com>, where a is referred to as the tag and href is the attribute of interest.

  7. Click OK to close the Add Extraction Rule dialog box.

  8. On the File menu click Save to save the Web performance test.

  9. In the Web Performance Test Editor, click Run to start your Web performance test.

    The Web Performance Test Results Viewer is displayed.

  10. In the top pane of the Web Performance Test Results Viewer, click the request to which you added the validation rule.

  11. In the bottom pane of the Web Performance Test Results Viewer, click the Details tab.

    The Validation and Extraction Rules grid is displayed with an entry for the extraction rule you just added.

  12. Click the Context tab.

    A grid of names and values is displayed. The last entry will be the FirstLink variable and its value. The value should match the first <a href> on the requested page. You can verify this by viewing the requested page in a browser, viewing the source of the page, and searching for the first href.

See Also

Tasks

How to: Create a Custom Extraction Rule for a Web Performance Test

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

How to: Edit an Existing Web Performance Test Using the Web Performance Test Editor

How to: Add an Extraction Rule from the Web Performance Test Playback

Concepts

Using Validation and Extraction Rules in Web Performance Tests

Other Resources

Creating and Editing Web Performance Tests