Thursday, July 30, 2009

Test Driven Development in .NET

Test-driven development is a development pattern which is characterized by the use of pre-written test cases which are continuously validated via an iterative, incremental development process. 

The basic process is: 
Write the test.
Write the code which is tested by the test from step 1.
Validate that the new test and all previously implemented tests run successfully.

The process is repeated for each test until the code is fully implemented. 

Benefits of test-driven development include: 
Forces simplicity in the code by breaking down complex tasks into individual subtasks.
Ensures that the developer understands the intent of the code before writing it.
Allows defects to be detected early in the development lifecycle.
Prevents regression by identifying breaking changes prior to release of new versions of the code.

It is important for buyers of software to understand that a solution developed with automated testing (whether or not it is a result of test-driven development or build-then-test development) will have a higher up-front cost. However, automated testing can be expected to pay for itself over the total software asset lifecycle through reduced occurrence of bugs and the limiting of regression.

No comments: