One of the Biblical stories I turn back to time and again is that of Jesus’ testing in the desert.
To Test or Not To Test: Unit Testing and Privacy
Determining which methods in your application needed testing used to be easy – test everything exposed by the public API. But once you invite other developers to contribute, you are exposing a whole other set of internal APIs to the team. The behavioral consistency of these methods is just as important as that of the public API, so shouldn’t you be testing them too? I would argue you should, even if this internal API consists of private and protected methods. To make life easier, I’ll give you a couple of tools for testing these limited-visibility functions without forcing everything to be declared “public.”