002: Testing the Limits of Fun

WHAT

I wrote a test that depended on the month of “JanuMarch.” Said test broke several weeks later when the code was sensibly changed to validate actual months.

WHY

  • Code/Database only cared that month and year were Strings.
  • Shockingly, date validation seemed to be ignored in the project.
  • Crazy month names make me laugh.

    Lousy Smarch weather!” —Homer Simpson

LESSON

There is an appropriate amount of fun to have while writing tests. In the case of date, it was obvious that Strings weren’t a good solution — a date object was a much better one. I have the pleasure of working with people who this was also clear to. In time, they changed the poor implementation to a good one and had to deal with “JanuMarch”.

We all had a good laugh, but it still unnecessarily slowed us down. It’s important to have fun at work while not causing problems. If one thinks it’s ridiculous validations are not yet implemented, still write tests that will pass validation once in place.

SUPPORTING EVIDENCE

bar graph of testing fun

Published Sep 10, 2010