Επεξεργασία

Κοινή χρήση μέσω


How to: Create SQL Server Unit Tests for Functions, Triggers, and Stored Procedures

You can write unit tests that evaluate changes to any database object. However SQL Server Data Tools includes additional support for creating tests for database functions, triggers, and stored procedures from a database project node in SQL Server Object Explorer. Transact-SQL code stubs can be automatically generated for you to customize.

To create a SQL Server unit test from a function, trigger, or stored procedure

  1. See Walkthrough: Creating and Running a SQL Server Unit Test for an example of adding a unit test for a stored procedure, in the "To create a SQL Server unit test for the stored procedures" section.

    The Inconclusive test condition is the default condition that is added to every test. This test condition is included to indicate that test verification has not been implemented. Delete this test condition from your test after you add other test conditions. For more information, see How to: Add Test Conditions to SQL Server Unit Tests.

See Also

Creating and Defining SQL Server Unit Tests
How to: Create an Empty SQL Server Unit Test