This page explains you the difference between:
Basically, you need to look at the inversion of control principle:
- your code invoke the library (the library plug into your code)
- your code is invoked by the framework (the framework invokes your code and offers has a plugin/extension system for your code)
With a library, it's easy to test your code whereas within a framework, the framework should provide a test feature.