Dependency Injection
Ask for things, don't look for things.
Part eleven of a series of posts about automated testing.
To make unit testing possible, you need to be able to mock out accesses to resources such as the filesystem and databases. The best way to make that possible is to use dependency injection - ask for the collaborators at construction time.
For example, in Perl:
These collaborators can be wired up using a dependency injection framework such as Bread::Board, or manually. Mocking these collaborators out becomes much easier than if they were created by the Workshop class itself.