Open the Microsoft Visual Studio 2010 IDE (Integrated Development Studio) and select the Test Project template under Test Projects->Test Documents page as shown below. Note: In this demonstration I am going to show how you can create Database Unit Test cases in Visual Studio 2010 Ultimate edition although you can do the same with Visual Studio 2005/2008 Database edition too. Visual Studio provides Database Unit Test Designer which you can write/define T-SQL scripts (also insert SQL assertion in this code) that calls your module and then evaluates the execution result against the different test conditions which indicates your modules execution success or failure.
MICROSOFT VISUAL STUDIO 2010 TESTING TOOLS CODE
doing adhoc testing, but Visual Studio lets you automatically generate T-SQL code stubs to test the database object which you can customize as per your need. Apart from that, it is also used to ensure that subsequent changes to the module does not break any functionality.Īt first glace, it looks like this would add overhead to create vs. Solutionĭatabase unit testing is used for feature testing of your individual modules (stored procedures, triggers or user defined functions) that is to say your module performs as expected. How would you do that, how would you write database Unit Test Cases (UTC)? In this tip we cover how you can do this in Visual Studio. That is to say, you want to have smooth and fast regression testing for your database code. And more importantly you want to ensure that a change in an existing SP, UDF or trigger does not break the functionality. By: Arshad Ali | Updated: | Comments (4) | Related: More > TestingĪs a database developer you always want to ensure stored procedures, UDFs (User Defined Function) and triggers perform as expected.