Idea of automated unit testing is not new. There are several unit test frameworks on pretty much all programming platforms and you can find multiple publications regarding unit testing in every tech bookstore, so you can get familiar with the idea easily. Community is in line - unit testing is truly beneficial as it’s the best way to maintain proper quality of source code. What is more, unit testing promotes interface-based design of solution, what helps with code review and validation as well. Still, in my experience, projects using unit tests are a substantial minority. Why? What’s wrong with unit testing?
- In manager’s opinion unit testing is “expensive”, because maintaining unit tests requires effort (doubles the effort needed to modify the code itself) and quality of unit tests is hard to verify (so manager won’t rely on them…).
- Unit testing is a pain, because every test needs “context preparation” (database, configuration, external services) which is annoying to set up (and takes a lot of time).