A common kind of agile development practice is TDD. TDD is a pattern of writing software that uses tests to help you understand the final steps of the requirements phase. Write the test first, then write the code, which will consolidate your understanding of what the code needs to do.
Most developers think that the main benefit of TDD is the resulting integrated unit test set. However, if executed correctly, TDD can improve the overall design of the code, because it defers the decision to the final duty moment (last responsible moment). Because you don't make any design decisions in advance, it allows you to use better design options or refactor to better design at any time. This article describes an example that demonstrates the strengths of the design based on the results of unit tests.
TDD Work Flow
The key word in the test-driven development terminology is the driver, which means that the test will drive the development process. Figure 1 shows the TDD workflow:
Figure 1. TDD Work Flow
The workflow in Figure 1 is:
Write a failed test.
Write the code to pass the test.
Repeat steps 1th and 2nd.
Actively refactor in this process.
When you can't think of any more tests, you have to make a decision.