My Life As A Blog

Test Driven Debate

with 3 comments

I ran into this post the other day.  You’ve got to agree that’s an eye catching title for a blog post.  Reading a title like that you might expect an anti unit testing rant, whereas it actually makes the case for a pragmatic approach at the heart of which is testing.  And that’s important – the focus should be on delivering working software, not on making sure you’re doing a before b.I see a lot of value in unit testing and high unit test coverage – I think it encourages better design along with more confidence in the code base (although I’d like to see more capability a la Eiffel built into languages, which would allows us to junk a bunch of the grunt tests and would make the intention of the code clearer.)  I’m less sure about TDD. There’s no doubt it has its passionate followers, but the focus on the how may be at the expense of the why, and that’s a niggling doubt.

Written by remark

March 11, 2008 at 11:01 pm

3 Responses

Subscribe to comments with RSS.

  1. As i’m sure you understand, the point of TDD is aiding DESIGN. You just so happen to get a nice suite of tests as a side-effect. Adding the tests after doesn’t improve your DESIGN as you’re obviously coding with preconceptions. In my experience the key gain with TDD is maintaining a very narrow focus on one task at a time (signified by your failing test) rather than big bang coding.

    Moving on from this… I’ve had to retrofit tests, I’m sure you have too Mark! Its decidedly more difficult after as you have to get into the mindset of what you, or in most cases someone else, were doing initially. Plus we all know it rarely ever gets done at all anyway when testing after!


    March 12, 2008 at 6:44 pm

  2. Ben,

    Good to get your thoughts on this debate. I am convinced that testable design is important and that high test coverage is also important (rapid feedback, assurance, etc, etc.) I’m just not convinced that the tests have to be written first first to achieve these goals – it’s possible that there are different means to achieve the same end. My concern is that the focus is moved from the objective to the process. So, I thought it’d be worth bringing 3 more views into the mix:

    Test-Driven Development and Exploratory Testing
    Testing Misconceptions #1: Exploratory Programming
    Test Driven Development When Writing New Code


    March 13, 2008 at 11:13 pm

  3. Keep in mind that functional tests are the only tests that really matter to your users

    That is what I believe too. My belief is that ultimately for any software there are two users:
    – The consumers of the application (people, other systems being integrated with), those consumers expect that the system is fit for purpose and that can be tested using acceptance tests, those tests ideally would test as many stacks as possible of the system from top to bottom.
    – The developers of the application (actual software developers and their sponsors), those consumers really benefit from unit testing because it will allow them to use an agile approach to developement which is known to produce working software after a few iterations. The other side effect is after release, maintenance and improvement of the software will be much easier.

    I would say there is too much focus on unit testing these days above other testing approaches which too can provide greater confidence in the quality of the software being written.

    I read somewhere that unit tests are to prove your code is right, whereas acceptance tests are to prove that you’ve produce the right code.

    Daniel Fernandes

    March 20, 2008 at 8:53 am

Leave a Reply

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

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

%d bloggers like this: