There are probably a lot of misunderstandings about Test Driven Development (TDD) and a general unawareness about what it is so I am hoping you will gain a better understanding after reading this article. I have a nice image on the left which will help to provide better information for TDD. The general thought process is by creating an initial test case which is designed to fail, the developer will design better code which will make the test pass.
- The TDD test created will be a simple unit test that will affect a very small piece of code.
- Once the unit test has been created it needs to execute and fail.
- The developer will then write code to get the test to pass.
- The developer will refactor code to make it simpler and more efficient.
- The developer will repeat the process and add more tests over a period of time.
- There is a significant number of defects that are reduced provided this approach is used consistently
- The additional effort spend with save significant time on the downstream teams since less time will be spent fixing and retesting defects
- Code design improves
- Forgetting to run the tests
- writing too many tests
- writing tests that are too detailed
- writing tests that are not effective
- only used by some of the developers on the team
- tests are not maintained over a period of time
- new team members don’t use previously created tests