What is TDD?
Test Driven Development or TDD in short, it is an advanced objected oriented software development methodology which mostly use in Agile process.
It is a methodology that focus on turning requirement in to each specific test case so developer can make sure that product met with every requirement. Additionally, using TDD can help developer to cover most of possible bug before it even occur.
1 requirement can turn into single test case or multiple test case.
Long story short, it is a test first development. Design test and then Implement code later.
These 2 picture show the different between traditional and TDD process.
TDD add design test case phase between design and implement phase.
TDD Mantra
TDD include 3 mantras including Red, Green, and Refactor.
- Red is developing a test.
- Green is implementing code to satisfy each test.
- Refactor is improving the quality of code.
Let look at the closer detail of TDD process