Interaction-Based Testing: Beyond Classical Unit Testing
Dr. Dobb’s Architecture & Design World
July 2007

Interaction-Based Testing: Beyond Classical Unit Testing
This tutorial is focused on the practical use and application of interaction-based unit testing using dynamically generated mock objects. Attendees will follow along with the presenter in pairs on their laptops through the instruction and examples of interaction-based test driven development. While the principals and standards that will be covered in this tutorial apply to many development environments, the examples and projects will be done in either Java or C#. The tutorial will be divided into three parts. Part one will briefly review the methods and purposes of state-based unit tests. Examples will illustrate classical state-based TDD. Part two will introduce the problems and development road blocks often encountered when developing software using state-based unit tests. A few exercises will be presented and worked on by the class with the assistance of the instructors. The third and longest part of the tutorial will introduce the concept and benefits of interaction-based unit testing. The purpose and use of mock objects will be described and the use of dynamic mock generation libraries will be demonstrated. Examples and exercises based on interaction-testing will follow.