Lazycoder

6Feb/064

TDD installation is hard

Jeff has another big long comment thread over at his place. I’m poluting his comment section a lot over there. Anyway, this one involves the sacred cow that is Test Driven Development.

Coding Horror: Revisiting Edit and Continue

One of my points is that GUI testing with TDD is next to impossible. How hard is it. They can’t even unit test their installation dialog boxes.:) This is the dialog box I’m presented with when I try to install the latest build of TestDrivenDevelopment.net

tdd_error

So I can’t install it and I don’t know why.

FWIW, it appears to be because I was installing it from a network share. I copied the file to my Desktop and ran the installer and it succeeded

Filed under: General Leave a comment
  • http://www.codinghorror.com/blog/ Jeff Atwood

    Quite the Zen dialog. Love it. Make that a feature.

  • http://haacked.com/ Haacked

    Well I wouldn’t call it a sacred cow. The good TDD people knows it has limitations. We’re not purporting that you can cover ALL your code ALL the time. As I’ve written in the past, you still have other important tests to perform such as integration tests as well as system tests.

    But think of it this way, if you COULD automate the testing your QA people did, wouldn’t you want to? We can’t automate integration tests and system tests that easily, but we CAN automate unit tests. Why wouldn’t you want to? Especially if by following TD practices you will improve the quality of the code. Note that I didn’t say your code would be perfect. There is no such thing.

  • Scott

    Phil, I’m not entirely sure from some of the comments and articles that some of the TDD advocates share your realistic approach.

    “Back in the day”, we did unit testing and even automated builds in VB using batch files and test harnesses that would pop up little message boxes with a “Pass” or “Fail”. Sometimes they even had cute little icons. And we did it without all of the pretty little apps they use today dagnabbit! I even had QA guys that automated GUI testing by hooking into the Win32 API and manipulating the cursor. They were insane though.

    I’m not sure that I like the attitude of “If you aren’t with us, you’re stupid and against us” when it comes to software development methodologies. I’m sure it works well for some people and I know I’ll be using it if I get to write any new code. But for legacy code and web apps… I mean, how do you test the render method of a web control? Do you need to? If you don’t, haven’t you introduced a vector for bugs in your client side? The most user facing part of your app. If you are creating buttons programatically, how do you verify that they have been created successfully and rendered correctly? It’s stuff like that, which is 90% of what I do, that TDD doesn’t seem to cover very well.

  • http://cs.thycotic.net/blogs/john_morales John Morales

    Scott, while you have some valid points, When it comes to web apps i do believe that unit testing is more than useful. I could debate on whether testing the guts of the render method is necessary but that would be a waste of time. What i found works is to basically use unit tests to test things that cause uncertainty. That said, i’ve never had to test the render method directly but _have_ had to create unit tests for certain other asp.net boiled-in functionality. I many times create blanket high level tests to verify implementations from a users perspective, but drill down to certain methods when things get flaky…

    The true value of unit testing a web application becomes realized in regression testing.
    E.G. When you make a change in how your DAL caches your objects do you enjoy clicking through every piece of functionality in your web application making sure nothing crashes?

    if you like that sort of thing then unit testing isnt for you.

    Bottom line: While not testing every single byte sent to the browser means that something has the potential to break, i can sleep better at night knowing that i’m in a better boat making a drastic change and my tests are still green, as apposed to making that change and crossing my fingers. Of course, I could just click a few links and convince myself its all good, right? Or I could click on 90% of everything (you mentioned its 90%) but then what time would i go to bed at? if at all?