Getting started with TDD
Briefly, Test-driven Development is the strategy of writing tests in parallel with the development process. These test cases are written in advance of the code that is supposed to satisfy them.
A single test is written, and then the code needed to satisfy the compilation of this test is written, then the behavior that the test decrees should exist is written. We continue writing tests and implementation until the full set of desired behaviors is checked by the tests.
This contrasts with other approaches to the development process, where the tests are written at the end when all the coding has been done.
Writing the tests in advance of the code that satisfies them has the following advantages:
- Tests get written one way or another, while if the tests are left till the end it is highly probable that they will never be written
- Developers take more responsibility for the quality of their work, when having to consider the tests as they code
Design decisions are taken in smaller...