Metafora
imho the great benefit of unit testing is the deep knowledge that you develop about your software: writing tests forces you to make a step back understanding how things work behind the scenes. that level of knowledge would not be possible otherwise.
Reply 2
@dolphin not easy to find a clear and easy to understand comparison with a "daily-life" scenario
Reply 1 Link
let's say to go to work you simply need to move from A to B, and you stick with it for months. after a while you accidentally realise there is another way to reach your destination, shorter, faster, and with a better coffe shop along the way. Now, if instead of sticking with the first solution you would have kept exploring your surrounding, you could have discovered this better solution way sooner
Reply 1 Link
@dolphin
Unit testing is a cross between interrogation and introspection.

It's like when your wife/gf asks you loads of questions about the girl you were talking to last night, most of them stupid edge cases, and you have to come up with decent answers (tests).

Shortly afterward you begin to introspect about future "other girl" interrogations and how you can defend against them and have answers ready, perhaps it even means changing your behavior to reduce certain risks (main code edit).

Upon mounting a successful defense, perhaps you even being to wonder about who you are as a person and start imagining about all of the "what ifs", what if I did cheat, what if she said we kissed and we didn't, what if I do actually like her. haha (either bin the unit test as it's too exposing, or scrap the project in search of something shinier)
Reply 2 Link
A project of Million Token. FAQ