O'Reilly logo

Scala Test-Driven Development by Gaurav Sood

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6. Mock Objects and Stubs

Mocks and stubs are essential to any test-driven or behavior-driven testing frameworks:

 

"The term 'Mock Objects' has become a popular one to describe special case objects that mimic real objects for testing. Most language environments now have frameworks that make it easy to create mock objects. What's often not realized, however, is that mock objects are but one form of special case test object, one that enables a different style of testing."

 
 --Martin Fowler

In this chapter, we will discuss:

  • History of mock objects
  • Couplings
  • Stubs
  • Mocks
  • Fakes
  • Spy
  • Mocking frameworks

History

During one of my several Agile incarnations, I had the opportunity to work with Tim Mackinnon who was involved in the development of the concept ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required