On Jan 8, 2008 7:14 PM, Daniel T. [email protected] wrote:
Might be a personal thing, but my approach is that I try to test the
public behaviour of the object. Testing private methods is, imho,
getting dangerously close to specifying how the object does its
business, rather than what it does.
I would just spec the externally visible behaviour, where it occurs,
and let the object implement it as it wants (using private methods or
any other mechanism).
The trouble is that this makes it very difficult to get effective
There is usually a lot more setup involved. If your tests are more
to write, because you are unit testing indirectly through public
less testing will get done, and worse tests can end up getting very
I do like the idea though of during the unit test itself, you unseal the
You get the best of both worlds.