Because the primary tools for unit testing are free and open source, the initial costs for trying and adopting unit testing are low. In addition, unit testing can be used with any form of development philosophy, so adoption is nondisruptive.
How to view the costs of unit testing
For all of its benefits, unit testing does have costs.
The first cost is that it takes time and skill to write good unit tests. The skill is quickly learned if the organization buys into the concept. But the time spent is a harder sell, because managers often equate time spent on testing with time stolen from writing code. They forget about all the debug time that is later spent, time that unit testing would reduce by placing that work up front, when the testing is easier and the effort to fix the code is less.
A second cost is that for unit testing to really deliver, all developers need to use it. And that requires upfront training and management participation, at least to start. Unit testing still delivers benefits to developers in isolation, of course, but the ability to see what is changed in the larger project due to a change in a specific routine is lost.
A third cost is that when a software base changes in an important way, the unit tests must be discarded or substantially rewritten. In other words, the innate cost of making large-scale changes to a code base increases if unit tests are part of the mix. But it's easy to overstate this cost. After all, large changes in the middle of the coding phase should not occur often. And when they do, if any of the old code in the changed components is reused, the associated unit tests still provide value.
Most organizations that see past these concerns and actually try unit testing usually find the return is well worth the cost, and typically expand their unit testing efforts. Still, they have to get over that initial resistance. And that's why, Glover remarks, "Unit testing is likely to remain a niche solution, found at organizations that really understand its value and progressively adopted by sites that can no longer stand the long debug cycles."