Unit Testing isn’t necessary once you get a bit of experience down you…

What a crock. Following hot on the heels of Phil’s ‘Old developers get on my nerves and smell of soap’ post (not altogether accurate quote, more paraphrasing) I stumbled, via hanselminutes across this load of old tosh…

It appears that once you have 21 years of development experience under your belt you can divine whether your code works correctly using the force.

I have not really got into ‘Test Driven Development’ myself, now that isn’t to say it hasn’t got its merits, but my brain doesn’t work that way at the moment. I at least get a class defined with some method stubs in before I think about unit tests. I very often fill the methods out and I am sure there will be XP purists that balk at that.

I have in the last year written an application that because of time pressure I decided to do away with writing the unit tests. I think this is a reasonable decision to take if there just isn’t room to fit them in. I wish I had though as six months later the client was back for some new features that involved a bit of a reworking of some of the old stuff and it was a nightmare without the unit tests available.

You see, I am of the opinion that to consider unit tests as purely a time consuming mechanism for finding bugs is to undersell them. Bugs will out eventually, unit tests or not but the big thing for me, and the thing that gives the payback for writing them in the first place is when you come to do some refactoring or other. Particularly when things have got a bit out of hand. To be able to instantly see what has broken as a result of your changes is where it is at for me with unit testing. You also can’t argue that if you are able to automatically run a defined, possibly 100%, amount of your public APIs with every build then you are going to have a more robust application at the end of it than if you arbitrarily give it a manual runout.

The ‘time consuming’ argument is not really holding water these days either. I mean, you still have to write some stuff but there are plenty of tools that can lend a hand. Just out of the ones I have had a play with you have CodeRush that has some templates, Visual Studio will generate tests for you that need a bit (or a lot at times) of editing and there is nothing stopping you generating them with CodeSmith or any of the other miriad of code gen tools.

Judging from the comments Wil Shipley isn’t alone. I don’t mind people like that though…

…because they are wrong.

2 Responses to “Unit Testing isn’t necessary once you get a bit of experience down you…”

  1. 1 Phil Winstanley September 4, 2006 at 8:09 am

    Scott’s podcast had a recent bit on unit testing where he made some … odd points. I think he’s the Uri Geller of the Unit Testing world – SEE AS I BEND YOUR CODE TO SUIT MY NEEDS.

  2. 2 Flex Belt Bmr September 3, 2013 at 7:12 am

    I’ve been exploring for a little bit for any high-quality articles or weblog
    posts in this kind of area . Exploring in Yahoo I eventually
    stumbled upon this site. Reading this information So i’m happy to show that I’ve a
    very just right uncanny feeling I discovered just
    what I needed. I most without a doubt will make certain to don?t disregard
    this site and give it a glance on a constant basis.

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

RSS My Last.Fm

  • An error has occurred; the feed is probably down. Try again later.

%d bloggers like this: