Dependencies between the components that you have to test can make your life hard as a developer. To test anything more complex than a simple utility function, you might end up having to cope with tens of dependencies and their state.
This is why the idea of being able to provide doubles for testing in place of the real components was quickly born once the idea of automated tests became reality. Being able to replace the components the unit you are testing depends on with fakes, dummies, stubs, and mocks can make your life a lot easier and keep your test suite fast and easy to maintain.
The fact that any software is, in reality, a complex network of dependencies is the reason why many people advocate that integration tests are the most realistic and reliable form of testing, but managing that complex network can be hard and that's where dependency injection and dependency injection frameworks can make your life far easier.
Now that we know how to write automatic test suites...