After tweeting that I wanted to have suggestions for blog entries I got a single reply asking for my thoughts on DAO and unit testing – essentially asking should DAO be unit tested.
The problem with me answering this question is not that I don’t have an opinion but as the question was posed I was reading Steve Freeman, Nat Pryce on just that topic in their new book ‘Growing Object-Oriented Software, Guided by Tests’.
I have taken the diagramming style of the book for my own effort:
I think that the emphasis should be on keeping the ring around the core application as thin as possible. To definitely test persistence but to not make it part of the initial unit testing cycle. Unit tests need to provide rapid feedback and compared to inline code execution setting up and interfacing to a database is typically orders of magnitude greater.