Meaningless Drivel is fun!*
The moose likes Testing and the fly likes Test doubles == mock objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Test doubles == mock objects" Watch "Test doubles == mock objects" New topic
Author

Test doubles == mock objects

Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3479

Hey,
In TDD jargon, does "test doubles" refer to mock objects?
Thanks.
Eric Nielsen
Ranch Hand

Joined: Dec 14, 2004
Posts: 194
Not normally... ( though I have heard a few people use them as synonyms)

Normally, to me, a Test Double is more similar to a Stub. It allows the program to compile and run. It might provide some replacement behavior (a Test Double for an Email Sending class/service might log/store the emails somewhere for review, etc). But its not a Mock Object in the sense of setting expected calls and verifying that these calls were received as part of the test.

However, this article seems to use Test Double as a superset term including Stubs, Mocks, fakes, etc):
http://xunitpatterns.com/Mocks,%20Fakes,%20Stubs%20and%20Dummies.html
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Originally posted by Eric Nielsen:
However, this article seems to use Test Double as a superset term including Stubs, Mocks, fakes, etc):
http://xunitpatterns.com/Mocks,%20Fakes,%20Stubs%20and%20Dummies.html

That (the umbrella term) is the interpretation I've adopted, too.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
 
Don't get me started about those stupid light bulbs.
 
subject: Test doubles == mock objects