3 ms·
> The thing that unit tests are really good for is providing a safety net when you make changes In all projects I have worked on, extensive unit tests were not
by _pmf_ 6y ago
> The thing that unit tests are really good for is providing a safety net when you make changes
In all projects I have worked on, extensive unit tests were not a safety net against regressions, but a safety net against change.
- tonyarkles 6y ago> but a safety net against change Heh, yeah, that's fair, although I think there's some nuance in terms: accidental changes (to things that were working) is a form of regression in my mind. Depending on how the codebase is structured, changing the tests to match the new desired behaviour might be trivial or might be excruciatingly complicated. These days (mentioned elsewhere in this discussion) I'm working on more embedded stuff, and the only time I'm generally writing unit tests are for things that shouldn't change. As an example, last year I was working on a custom LoRaWAN stack. As I was building out the various pieces, I was writing tests to verify that the output from generally-pure functions came out as expected. (This packet) + (This key) = (This encrypted packet). Those kinds of tests help a ton for catching stupid mistakes.