Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Running SQL Server Unit Tests

Running SQL Server Unit Tests

 

To improve and maintain the quality of your code, you can create and run SQL Server unit tests that verify the behavior of any database object and then check those tests in to version control. As you or any member of your team changes the database schema, you run both SQL Server unit tests and software unit tests to verify that the changes have not broken existing functionality. You can run individual tests, or you can run groups of tests, which are known as test lists. For more information, see Using Test Lists (Visual Studio 2010).

You can run SQL Server unit tests in several ways that vary based on the software that you have installed, as the following shows:

You can run your SQL Server unit tests in a particular order by using an ordered test. For more information, see How to: Create an Ordered Test (Visual Studio 2010) or How to: Create an Ordered Test (Visual Studio 2012).

After you run your tests, the Test Results window shows which tests have passed or failed. For more information, see Interpreting SQL Server Unit Test Results. For more information about how to diagnose an unexpected failure, see How to: Debug Database Objects.

Creating and Defining SQL Server Unit Tests

You can define unit tests to verify the behavior of your database objects and associate each test project with a different data generation plan, deployment configuration, and connection string.

Custom Test Conditions for SQL Server Unit Tests

You can create a custom test condition to test for any condition that you cannot verify by using the default test conditions.

Show:
© 2015 Microsoft