If you came here with no reason, then stay this may be helpful to you someday, If you were looking for this exact topic that you are probably not in the right place, eventhough if you stay you will lear a few things and this could be kinda helpful to you so take a seat and enjoy about TDD.
For those who don’t know what TDD is, TDD stands for Test Driven Development, which is basically is a software proccess that stands on the repetition of various steps followed by a development cycle, the software is subject of very specific test cases that allows the user to have a controll over the software.
TDD follows a cycle that must fulfill the needs of a software in which stands
Add a test
Each new feature begins writing a test. The test defines a function or the improvement of an existing function. The developer must start by fully understanding the feature and its requirements. Some of the tests can be updates of an existing test. The use of tests before starting to write code lets the developer to focus on the requirements while writing code.

Run everything and see if something fails
In this step the existing code is proven to see if the new test is passed. If the existing code passes the new test it means that the test is useless or flawed. The new test should always fail because there should not be code that fulfills the requirements yet.

Code and do more code
The next step is to write the code to pass the test. It is not that important that the code is elegant or really well written. The most important thing is to pass the test. One thing you should consider is that the code must only fulfill the test and not add more functionality beyond that.

Test it out once more
If all test cases now pass, then the new code meets the test requirements and doesn’t break any existing features.
Restructure your code
The last step in the cycle is to clean up the code. Move it when it is more convenient according to the structure of your system. Eliminate duplication and in general follow the OO principles you already know. Try that your code is readable and maintainable.

and Finally…. Repeat
You finish once process and start another one with the new structure of your code, try to implement better way to compute things and to make it easier for the computer in space and time complexity, then repeat and repeat until you feel that the software is exactly what you expected from it.
My own experience
This is a topic that I have not mastered yet, you can tell, but I had the privilege to talk to Kent Beck, who is the one that rediscovered the TDD technice a.k.a. back in the day as extreme programing, because you repeated every process and a specific task over and over again, this is definetely of the lest known process in software development and one of the most effective ones, this is probably the reason you came to this post, in order to know a little bit more about this proccedure, if you ended up here by accident I recommend you to start developing your projects this way, you will see the diference once you start implementing it.
References






















