The power of unit tests
By ganton ~ November 10th, 2008. Filed under: Unit testing.
What i’d like to share with you is that the unit tests are really power and they make developers life much easier. I saw a lot of developers that said that unit testing is just a spent time in not right direction (developing code). As I remember in the beginning I also was in this group of wrong believers. But after a while I became a developer who thinks that without unit testing the code is hard to test and it is most likely not well formed. I hope everybody agrees that the use of TDD makes the code much more structured and well formed.
I’d just like to give you an example of how unit tests help us to not miss trivial errors. Last week in our team we saw that we need to extend one of our external modules with a new functionality. Before to extend it I realized that the module needs to be re-factored in order to extend the one abstract base class and to remove some common functionality from its descendants. It was done. Unit tests for the new functionality were written and the new functionality was implemented. And I ran the tests. What happen? More then 60% of our module unit tests doesn’t pass well. And the reason was a very trivial error which without unit tests I’ll found after integration of the module.
Conclusion, the unit testing is a part of software development that nobody should ignore. It will save time and efforts when you test your code and it will improve code quality. It is for sure.