Test-driven development (TDD) is an approach where you write a test before you write just enough production code to fulfill that test and refactoring. It also means thinking about your design first and then about code.
As Ron Jeffries says, the goal of TDD is to write clean code that works.The nucleus of test-driven development is Red, Green, Refactor. Red: Create a test and make it fail.Green: Make the test pass by any means necessary.Refactor: Change the code to remove duplication and to improve the design while ensuring that all tests still pass. The Red/Green/Refactor cycle is repeated very quickly for each new unit of code.A significant advantage of TDD is that it enables you to take small steps when writing software. For example, assume you add some new rough code, compile, and test it. It is much easier to find, and then fix, those defects if you’ve written 5 lines of code than five thousand. The implication is that the fast compilation and is easier to proceed in smaller and smaller steps. The final results of TDD, is the thoroughness with which they have been done and way they ape conditions encountered by users of the final product.
In my next blog I shall talk about about TDD ….