Test Driven Development (TDD) is a software development process based on writing a test before writing any line of code. This methodology is very useful, because it allows you to plan your application’s API while writing tests, and at the end you have two benefits: 1) ready specification for your app, 2) some assurance that your code is well-written. This methodology requires you to follow these 3 steps repeatedly:
- Write a failing test
- Write code to pass this test
- Refactor your code (while making sure you pass this test)
These three steps are often called “Red, Green, Refactor” because of the test util output.
Every time you make any change to your code you run the tests. That’s why tests run very often.