Introducing Visual Studio Team System 2008 Database Unit Testing, Page 4
There are many ways to generate sample data. By using Regular Expression options, you can even create data to look like common data patterns such as Social Security Numbers and phone numbers. I selected a Data Bound Generator to a SQL Server database along with an appropriate SELECT statement (see Figure 11).
Figure 11: Databound generator configuration
With sample data, I'm ready to configure the Test.
Setting Test Conditions
First, I'm returning to the TestProject Database Test configuration on the Test menu. I need to make the Data Generation Plan part of the project configuration (see Figure 12).
Figure 12: Incorporate Data Generation Plan
Now, I'll construct the test. The TSQL test code appears in Figure 13.
Figure 13: TSQL test code
As you can see, the second statement in the test code returns a result set. To verify that the test executed properly (see Figure 14), I'm going to inspect some of the properties of the returned result set.
Figure 14: Test conditions configured
I've added two test conditions. One checks the RowCount of the result set returned by the SELECT statement and the other verifies that the DBVersion field in the ResultSet returned by the SELECT statement equals "10.0", the version number I've set in the test data.
Executing the test is managed from the test menu.