Skip to content

Details

Has your suite of automated tests turned into a "Big Ball of Mud"?

Are you spending more and more time maintaining tests whose external dependencies are growing faster than the national debt?

Would you like to gain more of the benefits of automated testing, and less of the maintenance nightmare you fear they are becoming?

Mock objects can help. They allow you to verify that a class is living up to its responsibilities as a good citizen of your application's eco-system without requiring you to actually use the other components.

Safety engineers use crash test dummies to simulate the effects of different events on people -- without the messy part of actually involving real people. Think of mock objects as crash test dummies for your code. You can simulate the interactions your class is supposed to handle without caring if the other components are working properly -- and even without caring if the other components even exist!

OCMock is a framework for Objective-C that makes using mock objects very straightforward. We will investigate using mock objects for testing existing code, and then dive into some test driven design examples. We will use OCMock to help us determine the minimal interface required for our design.

Related topics

You may also like