News for hackers. Stuff that matters.
Re:Unit testing is not (generally) useful by jon_dahl on Thursday February 05, 2009 @10:50PM (#469321)
Unit testing can be this way, but it doesn't have to be. At a really low level, unit testing can be "testing the implementation", which may be useful while you're writing code, but isn't useful during a refactoring.

But slightly higher level tests can be written to almost never have this problem. Let's say you've written code to ensure that a CC transaction doesn't go through with an invalid number. No matter what the implementation looks like - no matter how much you refactor - this test should always work. The same is true for a wide range of useful tests. (These aren't strictly "unit" tests, but they fall into a similar category.)

My personal experience is that a good unit test suite is 99% useful when refactoring, and 1% painful.

There are no comments on this comment yet.