---
title: Testing - what to test when
url: https://www.grahambrooks.com/post/2010-10-20-testing-what-to-test-when/
date: 2010-10-20T00:00:00+00:00
author: Graham Brooks
tags:
- architecture
- Testing
---

# Testing - what to test when

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 &ndash; essentially asking should DAO be unit tested.

![Growing Object-Oriented Software, Guided by Tests](http://ecx.images-amazon.com/images/I/51Ia3QYtb-L._SL75_.jpg)

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:

![What to test when]({{ site.url }}/images/what-to-unit-test.png)

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.
