TDD as a software design methodology

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:

  1. Test-first development (write the tests first)
  2. Refactoring (code refactoring)

For this, a development cycle is used that consists of three main parts:

  1. The tests must fail (red)
  2. The tests must pass (green)
  3. 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).