Are old unit tests useful?

cathodion

Dustin King

Posted on August 27, 2018

Are old unit tests useful?

A little bit ago, I had some thoughts about old unit tests, which I posted on Twitter. Rather than restate them, here are the tweets:

Disclaimer: I'm not telling you to throw out all your old unit tests!

However, it has been my subjective experience that pre-existing test suites have caused me as much trouble as they've saved. On the other hand, maybe they prevented even worse problems I wasn't aware of. That's the problem with legacy code, though: you never know what it's okay to change.

Unit tests are often touted as a form of executable documentation. This is only true if they're written for the reader (or at least cleaned up/refactored for them after the fact).

What has your experience with pre-existing test suites been like? Have you encountered a really well-written test suite that lived up to the promise of "executable documentation"? Is there a better way to approach testing and existing tests?

💖 💪 🙅 🚩
cathodion
Dustin King

Posted on August 27, 2018

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Are old unit tests useful?
testing Are old unit tests useful?

August 27, 2018