It is a development methodology whose objective is to first create the tests and then write the software. Its acronyms is: Test Driven Development.
For test-driven development to work, the system must be flexible enough to allow it to be tested automatically and two methodologies must be combined, which are:
- Test-first development (write the tests first)
- Refactoring (code refactoring)
For this, a development cycle is used that consists of three main parts:
- The tests must fail (red)
- The tests must pass (green)
- The code must be improved (refactor)
Advantages of TDD:
- You can improve the code of your application at any time without fear that some module will stop working, given that the tests verify the perfect functioning of the application.
- Large amount of documentation, during the process of creating the code, we are solving doubts.
- The testing, development and analyst teams will be happier.
- The reading of the code will be much better given the examples of use (tests).