Can explain TDD
Test-Driven Development(TDD) advocates writing the tests before writing the SUT, while evolving functionality and tests in small increments. In TDD you first define the precise behavior of the SUT using test cases, and then write the SUT to match the specified behavior. While TDD has its fair share of detractors, there are many who consider it a good way to reduce defects. One big advantage of TDD is that it guarantees the code is testable.
Can follow TDD
Note that TDD does not imply writing all the test cases first before writing functional code. Rather, proceed in small steps:
- Decide what behavior to implement.
- Write test cases to test that behavior.
- Run those test cases and watch them fail.
- Implement the behavior.
- Run the test cases.
- Keep modifying the code and rerunning test cases until they all pass.
- Refactor code to improve quality.
- Repeat the cycle for each small unit of behavior that needs to be implemented.