› Benefits
There are a number of advantages to using TDD as a software development process. Here I mention some of these advantages.
-
TDD promotes iterative development where software is built in a step-by-step basis. In TDD, you identify a functionality that needs to be implemented, write a test for that functionality, implement the functionality to make the test pass, only if tests are passed, you can then start working on the next functionality.
-
TDD increases your confidence in the software you are developing. You get instant and frequent feedback on how well your software is working, whether the changes you’ve just made introduced problems, and whether the functionality you’ve just implemented works as expected when you've integrated it to the system. If there are problems, you will know right a way and fix these problems easily.
-
TDD produces a code that has less bugs and defects. That is an obvious result of the intensive testing that is required by TDD. Every single feature/functionality that you implement is tested several times before integration as well as after integration. Therefore, it is expected to detect most defects associated with the code being developed and fix these bugs more promptly and easily.
-
TDD promotes refactoring. You can refactor your code without worrying whether the changes you are about to made will break the code. This is because if you break something, you will immediately by running all tests again. The fact that all tests are automated in TDD makes refactoring cheaper to do.
-
Since developers in TDD refactor code frequently, they produce simpler and cleaner designs which leads to developing software of high quality. Also, a simple design usually means easier to change; errors in simple designs can be found easier and faster than errors in complex ones. Another benefit of creating simple designs is to make the process of changing and maintaining the software easier, which is one the overall goals of agile processes, which is to welcome and embrace user’s change requests.