Vadim's Weblog

Never stop learning.

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.

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: