Hacker News new | ask | show | jobs
by nostrademons 5655 days ago
The point of unit tests is to provide an executable specification. Ideally, the specification changes less frequently than the code does. In practice, the specification tends to change a lot too, but you should be able to perform optimizations or refactorings without having to change a whole lot of unit tests.

I know teams that have an "every change should break some unit test" policy, and IMNSHO those teams are making way more work for themselves than they need to. The point of tests is not to make sure that the code does what it does, the point is to make sure that it does what you need it to.

1 comments

Well put. The same goes for comments, too. Someone else asserted that good comments should reflect "Why" more than "What". "What" changes more.