Hacker News new | past | comments | ask | show | jobs | submit login

In my opinion there are two things that makes unit test really useful and they are API design and refactoring security. The article didn't talk about either of these.

Writing unit tests creates a mindset where the API for a class /method/module will be designed in a decoupled way to ensure that unit testing is possible. Writing unit tests force the programmer into creating software that is decoupled and modular.

You unit test suite is also a formal specification and documentation of what the program is suposed to do. This drastically reduces concerns and issue when refactoring the code base because if the tests are still passing the changed code has, with high probability, not introduced bugs. This of course relies somewhat on the tests actually being meaningfu and not tautological.

As pointed out in the article striving for 100% test coverage is not a good measurement of quality. Some things simply don't need to and shouldn't be tested.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: