2 ms·
I used to wonder the same thing, until I inherited a project with tests. The tests never caught a bug for the first 3 years. Got in the way a lot though. Then
by mattmanser 7y ago
I used to wonder the same thing, until I inherited a project with tests.
The tests never caught a bug for the first 3 years. Got in the way a lot though.
Then they finally caught 1.
Not worth it.
- jlangr 7y agoI don't see unit tests "catch bugs" often, either, in the sense that the CI build fails due to defective code pushed up. And even with TDD, I don't often find myself breaking a lot of things that were already working, though it does happen. In those infrequent cases, it's extremely valuable to know I broke stuff that was working. I.e., it's pretty sad to ship changes that broke other behaviors, things you had the faintest clue that you were impacting. What I do see gobs of, when doing TDD, is the tests preventing crap code from getting integrated in the first place, i.e. when I or others first write the code (or change the code of others). From the testing perspective, that's the real thing they do--gate the defects from ever leaving your desktop, and in a far faster manner than most other routes. Unless, of course, one is a perfect coder. In any case, TDD has more important benefits that I've also gotten. Easily worth it for me.