|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
About Extraction Rules
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.
Validation rules are similar to extraction rules, but instead of extracting data, they validate the existence of data. For more information, see About Validation Rules.
Visual Studio Team System Test Edition includes the following predefined extraction rules:
Extraction Rule Type
Extract Attribute Value
Extract the value of an attribute from a specified HTML tag.
Extract Form Field
Extract the value of a specified form field in the response.
Extract HTTP Header
Extract the value of an HTTP header.
Extract Regular Expression
Extract text from the response matching a regular expression.
Extract text from the response.
Extract Hidden Fields
Extract all hidden fields from the response.
Test Edition provides predefined extraction rules in the form of classes in the Microsoft.VisualStudio.TestTools.WebTesting.Rules namespace. However, you can create your own custom extraction rules by deriving from the ExtractionRule class. For more information, see How to: Create a Custom Extraction Rule.