3 ms·
> If you write your test after making the code changes, its easier to have a bug in your test that makes it pass for the wrong reasons. I see this a lot. I don
by napsterbr 7y ago
> If you write your test after making the code changes, its easier to have a bug in your test that makes it pass for the wrong reasons.
I see this a lot. I don't write tests first, but I always make sure my changes are properly covered by my assertions. For instance, when fixing a bug, I comment/undo my fix and make sure my test fails.
One could say I'm doing twice the work (fix, write test, comment out fix), but I find it easier than just writing the test first.