Three good reasons to make sure your code has full, solid test coverage:

  1. Tests are a transfer of confidence from you to the next developer down the line. It’s a joy to walk into a codebase that’s fully covered by solid tests. It means I can safely seek to understand only the part of system I need to alter rather than worry over side effects of my changes. It doesn’t guarantee there won’t be any side effects, but if there are, they’re either (a) found immediately due to the tests, (b) new, or (c) harmless.
  2. Tests are distributed ownership. The level of confidence I mentioned above means new developers can hit the ground running and start to take ownership of some portion of the code nearly immediately. In turn, earlier code owners can move on to the next interesting problem rather than taking a new job just to get their hands on a new challenge. Rapid onboarding, continued growth of mature team members – did you hear that, you managers of technologists? It’s in your best interest to demand your codebase is fully covered by solid tests.
  3. Time spent testing saves time. Time is your most valuable asset. Nuff sed.

You knew all this, though. You can’t have been a software engineer for any length of time without the test-early-test-often meme coming into your consciousness. What you did with it depends on the culture you were in at the time. For me, it was 1999 when I got my first SIGSOFT proceedings talking about this “coverage testing” thing which sounds really cool … but the studio where I was working didn’t much value testing and I was the juniormost engineer in a team of nearly 60 developers. They must know better than me, right? It took me a few years to get over that and start writing tests wherever I could. But I’m not bitter. Really.

One of the most incredibly great things about the Rails community is its passionate pursuit of testing. I don’t think I’ve ever seen a development community which values testing so highly, discusses it so frequently, and even goes so far as to make testing cool.

It’s cool to do the right thing? Excellent.



blog comments powered by Disqus

Published

31 August 2007

Categories

ruby/rails testing