How to: Add Test Conditions to Database Unit Tests
You can add test conditions to a database unit test by using the Database Unit Test Designer. When you save the test class, the test conditions are automatically saved in your test project as C# or Visual Basic code in source-code files. After you save a test condition, you can edit it either in the Database Unit Test Designer or in its source-code file.
To add test conditions to a database unit test
Open a database unit test.
The name of the test you opened is displayed in the navigation bar at the top of the Database Unit Test Designer. By using navigation bar, you can select the different test methods that are in your test project.
In the navigation bar, click the test method to which you want to add test conditions, or click Common Scripts.
Common scripts do not belong to a particular database unit test. Rather, they precede or follow database unit tests in a test run. For more information, see Scripts in Database Unit Tests.
In the navigation bar, click the T-SQL script to which you want to add test conditions. You can add test conditions to the pre-test, test, or post-test script.
The T-SQL script for that test appears in the T-SQL editor and its test conditions appear in the Test Conditions pane.
In the Test Conditions list, click a test condition and then click Add Test Condition (+).
The test condition is added to the unit test method.
You can reorder test conditions within a test method by clicking a test condition and then clicking the up and down arrows in the Test Conditions pane.
Select the test condition you just added and view the Properties window.
Configure the test condition in the Properties window. For example, you can change the Execution Time property of an Execution Time test condition. If you set this property, you cause your test to fail if the T-SQL script does not execute within the time that you specified.