3 ms·
Ash HN: Why Unit Test?
Why should I write unit tests? They take more time and are HARD!
- j_col 15y agoThey will save you time in the long run, because they automate your testing. If you spend some time writing a unit test to cover some code, you never have to worry about testing that piece of code again: it will be automatically tested every time you run your test suite. I also agree that they can be hard to write, however this will make you a better programmer as it forces you to really think about the code you're testing (for example if it can't be tested in an isolated fashion by a unit test, then it may not be modular enough).