Unit Testing Is My Zen Garden
I don't know why or how it happened, but unit testing has become one of the ways I relax myself while still being productive. It befuddles me a little because so much of my career has been about not having time to write unit tests. A lot of my work has been agency, contract, startup-esque work none of which affords time for writing unit tests. And it's not that I disliked this work, if anything I thrived in it. So one would assume that writing unit tests would be the opposite of what I want to do. But I find myself drawn to it when I'm feeling a particularly drained.
I think a big part of the reason is because this is the first team I've worked with a team that put such a focus on unit test coverage. The current measurement is readily available and a high number that the team is proud of. I think it's the ease of access though that really enables me. I can very quickly find code that isn't covered and within a few hours (usually) write something to cover it. There's something gratifying in that simple action of turning red lines into green.
There's also something gratifying about the simpleness of it. There's a nice focus to the problem that I find relaxing when my mind needs a break from a more complex problem. Sometimes we have to deal with complex problems for which there isn't an immediate solution. For some untested code though, it's often a clearer problem. The code does X and we just need to prove it. It can be nice not having to worry about a bunch of other factors as well. (And sometimes you find surprises in what you think the code does and what it really allows.)
Maybe you don't feel the same way I do about unit testing, but I would encourage you (if you don't already) to constantly measure your code coverage and stick that number somewhere prominent, like a dashboard. Given a little bit of time you may find, like I did, that adding unit tests becomes a productive way of unwinding for you too.