You won’t get away from this - if you measure how long it takes to code, how much time you need to write classes, etc., it will take longer with TDD. If you are experienced, it will add about 15%; if you are a beginner, it will take at least 60% longer, if not more.
BUT, in general, you will be faster. Why?
- By writing the test first, you indicate what you want and provide exactly that, and nothing more - therefore, saving time by writing down unused code.
- Without tests, you might think that the results are so obvious that what you did right is when it is not. Tests show that you did the right thing.
- You will get faster feedback from automated tests than with manual testing.
- With manual testing, the time taken to test everything as your application grows grows rapidly - this means that you will stop performing it.
- with the help of manual tests it is easy to make mistakes and “see” something passing when it is not, this is especially true if you run them again and again and again.
- (good) unit tests give you a second client for your code, which often highlights design problems that you might otherwise miss
Add all this, and if you measure from the moment of creation to delivery, and TDD is much faster - you get fewer defects, you take fewer risks, you progress at a constant speed (which simplifies the assessment) and the list goes on.
TDD will make you faster, not a question, but it’s not easy, and you should allow yourself a little room to study, and not be disappointed if it initially looks slower.
Finally, you should look at some BDD methods to improve what you do with TDD. Start with the function you want to implement and go down to the code from there, pulling out the stories and then the scripts. Focus on the implementation of the scenario decision scenario in thin vertical slices. This will help clarify the requirements.
Finnnk
source share