Apex provides a stub API for implementing a mocking framework. A mocking framework has many benefits. It can streamline and improve testing and help you create faster, more reliable tests. You can use it to test classes in isolation, which is important for unit testing. Building your mocking framework with the stub API can also be beneficial because stub objects are generated at runtime. Because these objects are generated dynamically, you don’t have to package and deploy test classes. You can build your own mocking framework, or you can use one built by someone else.
I was honored to be able to speak at my first Dreamforce and my two co-presenters were fantastic to work with. If you aren’t familiar with this topic, please check out either the Dreamforce ’16 video or watch the same presentation I gave a the Lehigh Valley Salesforce Developer Group