Mock Objects in Action

room: Grand Ballroom F — time: Thursday 16:00-16:45, Thursday 16:45-17:30
Level: Practicing

How can mock objects help you design your system better? Want to know how mocking saved hours of work? We focus on establishing best practices based on examples with mock objects. We cover design of classes, using mock objects to understand and test interaction between objects of the system. By the end of the session it should become clear how mocking,when applied correctly helps with system design, improves testability by reducing cost of change. An explicit part of this session is dedicated to the Mocking top offenders. We talk with examples about bad usage of Mocks, and its consequences.

Process/Mechanics

We will use three well known frameworks for testing few simple applications. We will compare, contrast and present ways to select a particular mocking framework for a particular project. We will also do some hands on coding to demonstrate how mocking effectively drives better testable code.

History of this tutorial

Paulo started conducting a session on mocking and testing when we was coaching a few developers. That session then turned into a training session conducted at ThoughtWorks internal training and was quite appreciated for its practicality. After a few additions to that sessions and adding mockito to the mix we presented it at a couple of conferences. It was received with a lot of enthusiasm.

Learning outcomes
  • Share our experience in testing.
  • Provide hands on examples to bring out the mechanics and thought process of testing.
  • Compare, contrast and enable people to choose the correct mocking framework for their application.
  • Paulo(Mock testing champion) and Sudhindra(agile purist) will pair on the presentation and examples to demonstrate how pairing works in testing and development.
Featured participants
Primary target persona