Pragmatic Unit Testing
Recently I was introduced to the Pragmatic Unit Testing book. This seems to be a nice summary of what we have been following as guiding light for unit testing on various projects.
One thing to note here is, in the Agile world, Unit tests are not a testing mechanism.
Reasons why I write unit tests:
1.They are the best, up_to_date functional spec.
2.They are the best, up_to_date design spec. If I want to know how this class behaves or how this class interacts with other classes, I would look at its unit test
3.They form a test harness around my code. Makes me feel so much secure about my code. I‘m no more in this illusionary world that my code works.
While I still have to figure out a best answer for what to test and what not to test, there is a good summary of unit testing principles that can help.
http://www.pragmaticprogrammer.com/starter_kit/utj/StandaloneSummary.pdf