The 5W1H of TDD
Last updated
Last updated
TDD is an acronym for Test-Driven Development
It is also an approach to software development
Accurate code and quality control are great side-effects of TDD, they are not the driving force behind the practice!
If code coverage and metrics become the goal, then there is a risk that developers will introduce meaningless tests just to inflate the numbers!!
TDD is not about testing, it's about design
To reduce errors and enable flexibility within the application
A method for rapid, accurate, and fearless application development
It is a means of letting your tests drive the design of the system!
With TDD, an application will grow in functionality without introducing needless complexity
It also lets us use tests as living documentation: Well-crafted tests describe the behavior in our code, and above all, serve as up-to-date documentation
Robert C. Martin, affectionately called "Uncle Bob" by the developer community is the driving force behind several practices including TDD
Kent Beck is also a leading proponent of TDD through his extreme programming methodology
Any fool can write code that a computer can understand. Good programmers write code that humans can understand.
– Martin Fowler
Though it was done under various names and methods from several decades, it was first introduced formally in 1999
In 2001, seventeen software developers including Uncle Bob and Kent Beck met at a resort in Snowbird, Utah to discuss lightweight development methods
By 2003 it was gaining rapid popularity all over the word
The Three Laws of TDD are as follows:
You are not allowed to write any production code unless it is to make a failing unit test pass
You are not allowed to write any more of a unit test than is sufficient to fail, and compilation failures are failures
You are not allowed to write any more production code than is sufficient to pass the one failing unit test
There are quite a number of testing frameworks that are free and open source, used for various types of tests. The most popular of the frameworks are MSTest, NUnit, and xUnit.net for .NET world and JUnit or TestNG for the Java stack
Learn more about these TDD laws at : http://butunclebob.com/ArticleS.UncleBob.TheThreeRulesOfTdd