Archives

Archives / 2008 / March
  • How To: Unit Test a T-SQL Trigger with VSTS Database Edition

    In Visual Studio Team System Database Edition, three types of functionality are unit tested; Stored Procedures, Functions, and Triggers.  It’s not so obvious how to test a trigger and at this time there are not many examples.  This is probably because there are so many different testing needs.  Testing the trigger is very similar to the more obvious calls to stored procedures and functions.  This example shows how a trigger can be unit tested using the RAISERROR method to cause a test harness failure.  Two other methods exist to perform unit testing failures for those complicated tests.