I like writing tests
I enjoy writing tests because I love what they give me.
- I love knowing that I’m adding defense against breakage from future changes.
- I love thinking through how a feature is really supposed to work, and having the test capture that understanding.
- I love thinking about edge cases that the code should handle, and writing tests for them — especially if it turns out that the code under test didn’t yet handle them correctly, because that means I’ve just saved us from a bug.
I can remember projects with zero test coverage (early in my career, I didn’t even know that was a problem) where implementing and shipping large changes was anxiety-provoking — both during the work, and after deployment. That awful feeling of holding your breath waiting for bugs to manifest.
Conversely, I’ve since worked on a lot of projects with good test coverage where similarly large changes are very comfortable to roll out. (And, since nearly every change comes with new and/or updated tests, that comfort keeps growing!)