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.
Predefined Extraction Rules
Visual Studio Team System Test Edition includes the following predefined extraction rules:
Extraction Rule Type |
Description |
---|---|
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 |
Extract text from the response. |
Extract Hidden Fields |
Extract all hidden fields from the response. |
Custom Extraction Rules
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.
See Also
Tasks
How to: Add an Extraction Rule to a Web Test
How to: Create a Custom Extraction Rule
Walkthrough: Adding Validation and Extraction Rules to a Web Test