CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Eric Wise

Business & .NET

Just want Karl to know he isn't alone

Karl made a confession and I just wanted him to know that not only is he not alone, but as far as the Agile Manifesto is concerned, TDD isn't even mentioned.  Too often I think we see people lumping TDD in with Agile when it's not really there at all.

As far as TDD is concerned, people fall into several camps:

  • No tests at all
  • Tests for complex processes only (my camp)
  • Tests for every single method in the application

Personally I find both extremes to be rather irresponsible when it comes to the business value and cost of what is being produced.  For example, I don't write unit tests for basic CRUD operations, in general the only time these break is if the database goes down.  It's simply not a productive use of my time to write tests for things that only fail if the database goes down.  Most of my tests revolve around calculations and financial data.

*shrug* I don't think there's a right or wrong answer to it, but I also don't think people should feel like they should be writing a few hundred tests regardless of the actual domain.



Comments

karl said:

Thanks :)
# June 22, 2006 11:03 AM

Brendan Tompkins said:

Eric,

I'm also in the camp who doesn't test first or write a unit test 100% of the time, but I think there's much more to having tests than you've implied.

"I don't write unit tests for basic CRUD operations, in general the only time these break is if the database goes down. "

You're right about CRUD operations not being very brittle, but the biggest reason to write tests for CRUD, IMO is to allow for safe refactoring in the future.
# June 22, 2006 11:13 AM

Eric Wise said:

Yes, refactoring is a situation where you write tests to validate that the functionality still works.  However I don't write those tests until I actually am ready to refactor.
# June 22, 2006 11:51 AM

Joshua Flanagan said:

The "unit tests 100% of the time" is a bit of a straw man. I don't think even the TDD zealots advocate that.
When you talk about databases going down, you aren't even talking about unit tests (following the Feathers definition that your unit tests do not have any external environmental dependencies), which are the basis of TDD.
# June 22, 2006 9:37 PM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add
Check out Devlicio.us!