MSDN Magazine Launch Issue - February 15, 2008 - (Page 65) Jamie Laflen Unit Apply Test-Driven Development To Your Database Projects n November 2006 Microsoft released Visual Studio® Team System Database Edition, also known as DBPro or Data Dude, which introduced a product lifecycle methodology to database development. DBPro also introduced a database unit-testing designer that makes it easy to either generate or write T-SQLoriented unit tests to verify database objects prior to deployment. In this article, I will dig into database unit testing, explain how the feature was implemented, and show you how to perform unit testing of your own database projects. of code needed to compile the test. Once the test has compiled and failed, the developer writes only the code necessary to make the test pass in the next run. With each iteration, all unit tests are run to verify that there are no regression errors. The application and unit-test code are then checked into source code control. Each unit test is run at least twice for the method being developed. To be useful, a unit test must set up its execution environment before it is run so that it can consistently verify the code it is meant to test. Once the test has been implemented and verified, it testing Unit Testing in Software Development This article uses the following technologies: Visual Studio 2008, SQL Server In software development, unit testing plays a critical role in ensuring that the proper level of quality is maintained and that milestones are met. Although most developers agree that unit tests are important, most don’t take the time to write the unit tests at the end of a product cycle. To address this issue, the test-driven development (TDD) methodology was conceived. Using this methodology, developers write unit tests for individual features before actually implementing the feature. This process allows the developer to see the API from the outside-in, thus providing the opportunity for the simplest design possible. Today, many developers working in C# and Visual Basic® follow TDD by creating a unit test to exercise a method on a class that has not yet been written and then implement the bare minimum amount This article discusses: The benefits of TDD ✥ Bringing unit testing to your database development ✥ Combining T-SQL and .NET–compliant languages ✥ Connections, test conditions, and transactions ✥ Code download available at: msdn.microsoft.com/msdnmag/code08.aspx Jamie Laflen is a Tech Lead on the DBPro team; he is responsible for the unit testing, data generation, and build/deploy features. Prior to joining the development team, Jamie was part of Microsoft Services and helped customers implement .NET applications inside Visual Studio. launch2008 65 http://msdn.microsoft.com/msdnmag/code08.aspx
For optimal viewing of this digital publication, please enable JavaScript and then refresh the page. If you would like to try to load the digital publication without using Flash Player detection, please click here.