jMock. Supporting Responsibility-Based Design with Mock Objects
Courtyard, Demo room 1
Wednesday, 11:30, 45 minutes
This event is also being given Tuesday at 12:30.
Steve Freeman, ThoughtWorks
Tim Mackinnon, ThoughtWorks
Nat Pryce, ThoughtWorks
Joe Walnes, ThoughtWorks
Demonstration number: 2
jMock is a dynamic Mock Object framework that supports responsibility-based design when programming test-first.
Test-Driven Development with Mock Objects is a technique for concentrating on the relationships between objects. It guides the programmer to discover the precise dependencies that an object has on its neighbours, and the interfaces that describe those dependencies. This is much more powerful than the usual use of Mock Objects which is to support development against third-party libraries.
jMock allows the programmer great flexibility in describing interactions between objects. We have also taken care to develop an API that makes tests readable and self-explanatory; in effect, we have written a domain-specific language for testing that sits in Java and C#.
In this demonstration we will show the flow of the mock object development process. We will show how using mock objects to guide your design results in a more effective form of test driven development and more flexible code; how mock
objects allow you to concentrate more on end-user requirements than on
infrastructure; and how the objects in the resultant code are small and
loosely coupled, with well-defined responsibilities. We will also provide a tour of the structure of the jMock libraries.