# Wednesday, September 29, 2010

Test Driven Development

I've never really bought into test driven development.

It's a funny thing. I was looking at one of our projects the other day and I thought "jeez, without these unit tests there's no way we could support this app". And then I got to thinking... How can I be so keen on these unit tests without ever really pushing into TDD.

Like I said, it's a bit of a funny thing. 

And actually, to be totally honest, I don't really know that what I call a unit test would cut the mustard with a unit testing purist.

See, the unit tests I "like" are big, end to end, epic story type unit tests. None of these verify a factory method, test a function type things. I like a test that creates a deal, loads a vehicle, applies an insurance package, calculates a payment and finally save the deal... Almost like a use case. 

Now these types of test cases typically involve dozens of classes, test data elements, and pretty in depth understandings of how the system works as a whole... But I'll tell ya... Get a dozen or so of these in a project and it's amazing the types if things they catch.

I've had data bass layer issues, calc reworks, new insurance types, all sorts of "benign" enhancements get captured by a simple unit test which behaves like a user and simply tries to simulate a daily operation.

I think that's why the TDD thing doesn't work for me. Seeing one class or component act on it's own doesn't show how it "plays with others". Ultimately it's the sum of these components working together that defines the system and unless you can relate a test to a larger goal they just feel contrived.

#    Comments [0] |
Comments are closed.