I have found this great excerpt about TDD, Original articles:
https://khalilstemmler.com/articles/software-professionalism/developer-principles/
TDD (Test-Driven Development)
One of the most controversial trends to hit the industry has been TDD. It’s worked for some, and failed for many others. But the reason I think it fails is because sometimes we try to treat TDD as law.
Fallacy of a strict Red-Green-Refactor Loop
In TDD, there’s a concept of a Red-Green-Refactor loop. It goes like this.
Red: Write a failing test
Green: Write the code to make the test pass
Refactor: Refactor the code when needed in order to improve the design.
Don’t treat this as a dogma. You don’t have to execute TDD in this order to feel like you’re doing it properly.
That’s not important. You don’t have to stick to the loop by the letter.
What’s important is that you write the tests while you code (or before you code) in order to reap the benefits of TDD.
The primary benefit of doing this is that you know right away if your code is testable or not. And if it’s not, you can take action right then and there before you pour some concrete that is going to be hard for yourself and anyone else to change in the future.
Knowing how to write testable code can be taught. That’s one of the benefits of the SOLID principles, and it aims to address that.