How to: Create a Test-level Validation Rule
You can add validation rules to Web tests at the test level. A test-level rule fires on every request in the test. In other words, adding a test-level validation rule is a shortcut for adding the same rule to every request. By default, such rules apply only to top-level requests. In the code of a coded Web test, you can apply test-level validation rules to dependent requests.
One purpose for using a test-level rule is to detect incorrect flow in a test. Errors in the server application could cause such incorrect flow by causing the playback of the Web test to vary from the recorded sequence. You can also create test-level rules to check content length and response time, to validate content that must appear on every page, or to validate that all pages conform to a specific criterion such as accessibility.
There is no way to override or turn off a test-level validation rule for a given request. If a request contains the same validation rule as a test-level rule, both rules will fire.
To add a test-level validation rule
Open a Test Project that contains a Web test.
Open a Web test in the Web Test Editor.
If at least one test-level validation rule exists, the Validation Rules folder appears after the final request in the test. You can add, delete, and modify validation rules at this level in the same way that you can work with validation rules for an individual request.
Right-click the Validation Rules folder and select Add Validation Rule.
- or -
Right-click the Web test node and then select Add Validation Rule.
The Add Validation Rule dialog box appears. Under Select a rule, you see the available predefined and custom validation rules. Select a validation rule.
(Optional) Under Properties for selected rule, edit or add options and parameters.
Run your Web test.