4 ms·
There are obviously many reasons, but to add a couple; Fight regression You don't want to fix the same bug several times, do you? When a bug is found, I first
by ZeroMinx 15y ago
There are obviously many reasons, but to add a couple;
Fight regression
You don't want to fix the same bug several times, do you?
When a bug is found, I first write a test to repeat the bug. Then I fix the code. Now every time I want to release a new version, that particular bug is tested yet again.
The 'quick fix' 5 minutes before launch
You're approaching deadline, everything is looking fine. Then, just before launch, a small bug or a tiny new feature has to be added. You can't imagine that would have side effects, can you? Well, that one bit of code, a small module that 'never changes', which you haven't looked at for 12+ months, reacts badly to this change. With good tests in place you catch this before you hit production problems.
- d0m 15y agoAnd, when it does happen, you thanks yourself for the times you thought it was unnecessary tests, but still wrote them to be safe.
- abstractbill 15y agoThe 'quick fix' 5 minutes before launch The universe tends towards maximum irony, and you are seriously underestimating that maximum. Even with 100% test coverage, fixing something 5 minutes before launch is an awful idea. Either delay the launch, or accept that the bug is small enough to not matter.
- ZeroMinx 15y agoYes, I can/do not deny the power of the irony gods. awful idea, yes, I agree, but real world is full of awful ideas. You can either accept it and adapt, or be drowned by it.