Is unit testing about testing?

Well, yes, but not entirely. The reality is that if test driven development is being followed a significant number of the tests will be of questionable value in that they are likely to test the obvious. Some code just isn't all that risky. However testing isn't entirely about testing, it is as much about process and enforcement. If you are using test driven development then you are being forced to think about your design in detail, you are also forced to keep your code testable which implies less coupling. To make code testable you are going to need to use dependency injection which sometimes isn't easy to do, but it does separate out the functionality of the code and help to get a better result.

Unit tests are also a great source of accurate documentation by example.

So, my view is that unit testing is as much about the process as the resulting tests.

Site Section: