I see that a lot of people using unit tests as a main selling point for TDD. I disagree with that. I believe that the main strength of TDD practice is that developers are forced to write loosely coupled code.
I don’t want to minimize the importance of unit tests. They’re the safety net and also a great reason to use TDD but you don’t need to follow TDD practice to create unit tests.
I got inspired to write this after reading ‘Good practices are beyond testing’ article. The author of this post makes a point that if we have mocking frameworks that let us to take shortcuts than what is the reason for TDD. Here’s a quote from the article.
If we don’t need DI or interfaces for testing, then why do we need them? If testing can happen without it, then that behavior isn’t driven, right? Why can’t I make a big class if its testable?
Unit tests are must have but it’s not the reason we TDD.