I've seen a few people talking about the benefits of unit tests on the TL.

FWIW, my view of tests is that the value is much less about checking that your code is correct when you write it, and much more about avoiding accidental regressions when you're working on something else.
I think a lot of developers think "I don't need to write unit tests, I can easily verify my code works", and a lot of the time that's true.

But do you want to have to check it again every time you (or anyone else) changes anything else in the app, just in case something broke?
I often find the thought of manually testing code I just wrote more appealing than writing automated tests.

But tracking down a production bug in code that used to work, many months later, when I've forgotten all the context, is not so appealing.
And it's not just actual consequences of regressions that tests save you from, but also the *fear* of regressions.

That fear makes your cautious. It robs you of the confidence to refactor, and prevents you making casual improvements to your codebase in case it breaks something.
You can follow @nicklockwood.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled: