Kent Beck originally introduced test-driven development (TDD) to software development circles. I first learned of this development technique on mailing lists, after learning about Test First practices. I then read Kent’s book Test Driven Development: By Example to learn how to implement this technique in my software projects.
TDD evolved from the Extreme Programming (XP) methodology of Unit Testing first. It is a great part of any methodology, and is easily used in .NET projects. This article assumes that the reader has some familiarity with Test Driven Development and Unit Testing concepts. For resources to help you get started with TDD, I refer you to the end of this article, with links to other resources concerning TDD and unit testing.
Unit Testing Tools
In .NET development there are a number of frameworks one can use for Unit Testing.
nUnit is the big daddy, and is probably the most familiar to developers. Developed by Jim Newkirk, who is currently employed by Microsoft, nUnit is a C# port of jUnit. Other unit testing frameworks for .NET include
csUnit and
mbUnit (the latter is part of the Generative Unit Test framework). Most of these frameworks are open source, so the price is right. This article assumes the use of nUnit for any code snippets.
Articles and samples abound explaining unit testing for various types of projects. However, there seems to be a lack of articles or samples explaining TDD for a Business Intelligence project. This article hopes to fill that void. My experience with Crystal Reports, and its inclusion with Visual Studio.NET, made Crystal the obvious BI TDD choice.
Requirements
This article was developed using Visual Studio 2003, SQL Server 2000, nUnit version 2.2, and the Data Access Application Block from the Enterprise Library available on MSDN. The version of Crystal Reports used is the Crystal 10 Developer edition.