Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Effective Unit Testing: Does your book delve into Mock objects ?

 
ludoviko azuaje
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Lasse Koskela,

Effective unit testing requires testing on objects, but sometimes these are not at hand, we instead use mock objects to mimic those, as they easier to create.

Does your book delve into Mock objects ? I mean do you speak about its usefulness, mock libraries, etc ?
 
David Sachdev
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On this topic, I'm curious to know what Mock frameworks people use: JMock, EasyMock, Mockito, etc.

Also, are there new mocking frameworks out there that I may not be aware of? In general, I have been so happy with Mockito, that it is my default Mocking framework at this point in time, and I worry that maybe I'm missing the next great thing.

Thanks
David
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chapter 3 is dedicated to the different types of "test doubles", including mock objects but also lower fidelity utilities like plain stubs. What I've tried to do with Chapter 3 is to focus on highlighting the benefits and motivation for using test doubles and helping the reader identify what type of a test double they might need. It's not always a mock object that fits the bill best, although mock object libraries such as Mockito can be used in different styles. For example, a lot of people use a mock object library to create stubs.

As for specific libraries, we've used JMock and Mockito for the example code listings but we don't really teach either. Again, the goal for Chapter 3 wasn't to teach any specific library but to teach the fundamental concepts that may (or may not) justify using such a library.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic