When creating an API, if the input and output are not clearly defined, confusion can arise during the development process. This is why writing an API document is important, and I believe TDD is a technical version of the document.
At first, I questioned why we needed to write unit tests when the API documentation was already available. However, after applying TDD, I realized how effective this approach is.
Development is the process of building a system based on the plans we've created. Through TDD, I realized that it allows us to implement features more efficiently by sticking to the structure of the plan. Rather than developing all features first and then running tests to fix errors, writing tests upfront and addressing errors one by one as we develop the features saves both time and addressing errors one by one as we develop the features saves both time and energy.
- Develop API -> Test -> Find Error! -> Fix -> ...
- Test -> Find Error!(no API, no model... things haven't been developed yet...) -> Fix it(create Model, API...install...) -> ...
I think TDD is a technique for minimizing mistakes and staying on track throughout the development process.
Top comments (0)