2 ms·
true; unit tests will rarely find bugs, especially if you're writing the tests after the code. Unit tests are meant to ensure that when you add features, fix b
by valbaca 8y ago
true; unit tests will rarely find bugs, especially if you're writing the tests after the code.
Unit tests are meant to ensure that when you add features, fix bugs, or refactor, that you don't break what's already working.
If this means your unit tests don't catch bugs, then it could be that you're not introducing any! yay!
But I have found that by forcing myself into TDD, I do find more cases than when I was writing tests after code.
By writing the tests before I've begun the implementation, it forces you to think about preconditions, invariants, and postconditions in a more disciplined way.