4 ms·
Done well, unit tests are invaluable. I'm a relative late-comer to unit testing, but can attest to its value. The discipline of unit testing forces me to think
by misha67 10y ago
Done well, unit tests are invaluable. I'm a relative late-comer to unit testing, but can attest to its value.
The discipline of unit testing forces me to think about what risks I'm introducing with my new code.
Unit tests drive better design - smaller classes, looser coupling, better separation of concerns, functions that don't have side effects.
Best of all, unit tests reduce regressions. I can't count the times my test suite has prevented me from introducing a bug in my app.
I can refactor code with much more confidence than if I did not have 400 unit tests checking my work.
Most recently, these tests proved their worth when upgrading my app to Swift 3.0.