Test-driven development stands normal development practice on its head by writing tests before you do any coding, then writing that code carefully, consciously and deliberately to pass those tests cleanly and completely. Writing tests in advance of coding lets you specify the behavior you want from your code before you write it; you then use those tests to ensure that the program works as specified. This approach to design, test and implementation also means you are much more likely to get complete test coverage (100%, in other words) out of your code, which makes it far more straightforward to apply standard code refactoring techniques.
TestDriven.NET is a third-party unit testing add-in for Visual Studio that helps developers turn this concept from breathless prose into hard-coded reality. It supports a variety of unit testing frameworks, including Visual Studio Team System (aka MSTest), MbUnit, xUnit, and NUnit. TestDriven.NET works with all .NET Framework versions. Earlier iterations of TestDriven.Net were developed specifically for NUnit and went by the NUnitAddIn product name.
TestDrive.NET supports the following kinds of functionality:
- Single-click execution of unit tests within any method, class, namespace, project or solution right from inside Visual Studio.
- Snap evaluations for methods or properties using simple ad-hoc tests (right-click and select Run test(s) or Test With > Debugger).
- Ability to view any module or stack frame inside .NET Reflector while debugging inside Visual Studio.
- Executes inside its own process context to permit testing sans side effects.
- Support for debugging and code coverage analysis on any target tests.
- Works with all major .NET languages, including C#, C++, F#, and Visual Basic.
- Works with Visual Studio 2003, 2005, 2008 and 2010, running on 32- and 64-bit versions of Windows 2000, XP, Vista plus Windows Server 2003 and 2008.
Pricing for TestDriven.NET starts at $170 per seat for professional developers and $210 per seat for enterprise developers, but per-seat discounts are available; a free personal edition is available for trial, student or open source development use. See the TestDriven.NET download page for access, and the Quickstart page for a nice introductory tutorial.
Ed Tittel is a full-time writer and trainer whose interests include XML and development topics, along with IT Certification and information security topics. E-mail Ed at email@example.com with comments, questions or suggested topics or tools to review.