Vadim's Weblog

Never stop learning.

Archive for September 30th, 2007

The main reason to TDD; it’s not unit tests.

Posted by Vadim on September 30, 2007

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?

I personally switched from TypeMock to Rhino Mocks because TypeMock didn’t force me to write loosely coupled code.  I talked about this in one of my previous posts.

Unit tests are must have but it’s not the reason we TDD.

Posted in Rhino.Mocks, TDD | Leave a Comment »

 
Follow

Get every new post delivered to your Inbox.