Test-Driven Development
is an established methodology for developing better software faster. The writing of automated tests and the writing of code as well as improving software design through refactoring are closely intertwined.
The Red-Green-Refactor cycle starts with writing a failing test. Then, just as much code is written to prevent the new test from failing. Finally, the structure of the code can be improved.
Test-Driven Development reduces the risk of writing unnecessary code. There is also no code that is not covered by at least one test. Changes to production code cannot lead to unexpected side effects. This ensures that the written code is understandable to humans and not just to computers.
The main task of software development is not writing code, but understanding problems. Writing down goals as automated tests helps to understand a problem step by step. The tests do not drive the development as an end in itself, but do so by triggering the necessary thought processes.