We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

About Validation Rules

Validation rules help verify that a Web application is working correctly by validating the existence of text, tags, or attributes on the page returned by a Web request. Validation rules can also verify the amount of time it takes a request to finish, and the existence of form fields and their values.

Extraction rules are similar to validation rules, but instead of verifying data, they will extract the data and store it in the Web test context. For more information, see About Extraction Rules.

Predefined Validation Rules

Microsoft Visual Studio 2005 Team Edition for Software Testers includes the following predefined validation rules:

Validation Rule Type Description

Form Field

Verifies the existence of a form field that has a specified name and value.

Find Text

Verifies the existence of specified text in the response.

Maximum Request Time

Verifies that the request finishes within a specified amount of time.

Required Attribute Value

Verifies the existence of a specified HTML tag that contains an attribute with a specified value.

Required Tag

Verifies the existence of a specified HTML tag in the response.

Custom Validation Rules

Visual Studio Team Edition for Testers provides predefined validation rules in the form of classes in the Microsoft.VisualStudio.TestTools.WebTesting.Rules namespace. However, you can create your own custom validation rules by deriving from the ValidationRule class. For more information, see How to: Create a Custom Validation Rule.

Impact of Validation Rules on Load Testing

Execution of validation rules has an impact on performance in load testing. To reduce the performance impact, use the Validation Level of a request to control which validation rules are used in a specific load test. You can set the validation level of each rule to Low, Medium, or High. Typically, the higher you set the validation level, the slower your test will run.

Setting the Validation Level of a rule in a request determines when that validation rule is used in a load test. For example, setting it to High means that the rule is executed only when the load test validation level is set to high.

Load Test Validation level Description of Request settings used


Invoke only rules with a setting of Low


Invoke rules with a setting of Low and Medium


Invoke all rules - Low, Medium, and High

The ability to set the rule levels in both the Web test request and the load test setting gives you flexibility in your testing. Setting a load test setting to Low executes the fewest rules and can be used for heavy load test and stress runs. Setting a load test setting to High executes the most rules and should be used when validation is more important than maximum throughput.

See Also