Unit Testing Is Boring

Another post, by Pawel Brodizinski, via Dror, on when unit tests fail. I hear all of the above. Most of them have solutions based on practices.

But the one about unit testing being boring – I don’t have an answer to. Where I am today I can’t live without tests, and I don’t see how others do it. But I can see why it can be boring, and as such a barrier on the way to implementation.

Did you come up against this kind of argument? What did you say?

  • Uri Lavi

    Writing GOOD unit tests can be as challenging as writing good software.

    Despite the common opinion, the unit tests must be flexible, readable and well refactored. They should adhere to best practices: Single Responsibility Principle, Open Close Principle and etc…

    So, boring? I am not sure about it…

  • Gil Zilberfeld

    Uri,

    My point exactly, yet, as I’ve said you have to do it enough to understand it. Most people don’t unit tests, and some perceive it as boring.

    How long have you been doing unit tests?

  • Uri Lavi

    Well, I started to “play” with unit tests more than 5 years ago, but in the last 3 years I do it rigorously.

    As part of the refactoring process (which I mentor and teach in my courses), unit tests are the only tool you can relay on!

    BTW, typemock is great!

  • Gil Zilberfeld

    Uri,

    I fully agree with the benefits of unit testing. And they should counter the excuses for not doing unit testing, including boredom.

    And thanks, we’re very proud of our product!

  • Dirk

    If your unit tests are boring you are most likely not writing the correct tests. The “easy-to-write unit test that exploits optimistic scenario” is almost always boring to write, cos all it is setting up the data. The “border condition” or test for an existing bug is almost never boring to write, because it engages the mind. Problems are never boring.

    Pawel says there is not geek cred in unit test, I disagree you get lots of bragging rights: We have 200,000 unit test; Our project was on time in budget for the last 3 releases; These are good things to be able to say, especially in an interview. ;)

  • Gil Zilberfeld

    Dirk,

    200K tests – wow, you’re doing a hell of a job. I’d hire you…

    On the subject – like Uri, you’ve passed the stage I’m talking about. This is something that people that are getting introduced to unit testing say. It’s an obstacle (or excuse) for them on the way to get to where we are today.

    And while I understand what you call “problem solving”, most people at the beginning of the process think: “I don’t have time to write code, my boss wants me to write this boring stuff in addition?”.

    It takes a while (and lots of hands on experience) to go over this bump.

TOP