Understanding TDD
TDD is a software development process that relies on requirements being turned into very specific test cases. After writing these test cases, the code is then written and checked against other test cases. The final step in the TDD process is to iterate and improve the code to make sure it adheres to the best practices required and that the test cases pass. The cycle of a TDD approach consists of the following steps:
- Defining the functionality that needs to be implemented
- Writing a new test
- Running the test to check whether the test fails
- Writing code for the test case to pass
- Running the test against the added functionality to make sure the test passes
- Refactoring the code
- Repeating this process
The purpose of TDD is to visualize the end before development has started. That way, it is possible to foresee the problems or hurdles that may arise during the development process. Being able to develop a feature using the TDD approach...