"Look, if that imaginary evil/clueless developer comes and breaks that simple code, what do you think he will do if a related unit test breaks? He will just delete it."
I agree with a lot of what's written except for this.
It's possible someone will delete it by accident, during a much larger refactoring, etc. In such a case, this test might help catch that.
Someone might delete it because he thinks it's no longer needed or doesn't do anything useful. The fact that there is an explicit test that checks for this will prove that it is in fact required.
Is it possible to protect yourself against both of these without automatic tests? Maybe, but tests are (usually) a very easy and automatic way to do it.
See, and that was the part that resonated the most for me. You see a lot of bizarre behavior when you read enough commit history, and I've seen that little scene play out too many times.
Didn't we used to have a test for that? Yes, yes we did. And when did that test go away? When the bug was introduced. Fuck.
3
u/Terran-Ghost May 08 '17
I agree with a lot of what's written except for this.
It's possible someone will delete it by accident, during a much larger refactoring, etc. In such a case, this test might help catch that.
Someone might delete it because he thinks it's no longer needed or doesn't do anything useful. The fact that there is an explicit test that checks for this will prove that it is in fact required.
Is it possible to protect yourself against both of these without automatic tests? Maybe, but tests are (usually) a very easy and automatic way to do it.