Skip to content

Mocks, stubs and fakes

April 25, 2006 by Artem

I am rather new to the Test-Driven-Development (TDD) and continuous testing in general. Therefore I quite often experience the terminology difficulties: how to call fully functional alternative object, how to call almost empty stub objects, etc. It looks like I am not alone.

Martin Fowler highlights the Gerard Meszaros's proposal:

The generic term he uses is a Test Double (think stunt double). Test Double is a generic term for any case where you replace a production object for testing purposes. There are various kinds of double that Gerard lists:

  • Dummy objects are passed around but never actually used. Usually they are just used to fill parameter lists.
  • Fake objects actually have working implementations, but usually take some shortcut which makes them not suitable for production (an InMemoryDatabase is a good example).
  • Stubs provide canned answers to calls made during the test, usually not responding at all to anything outside what's programmed in for the test. Stubs may also record information about calls, such as an email gateway stub that remembers the messages it 'sent', or maybe only how many messages it 'sent'.
  • Mocks are pre-programmed with expectations which form a specification of the calls they are expected to receive. They can throw an exception if they receive a call they don't expect and are checked during verification to ensure they got all the calls they were expecting.

Nice dictionary. I am going to try using it for some time. How do you like these term definitions? Worth trying? Worth advertising to colleagues?

Comments

not alone

October 5, 2012 by Alex (not verified), 1 year 47 weeks ago
Comment id: 24217

You are not alone realy Artem, i am in same position now, and this post was sended at 2006 year...

english turkish dictionary | ingilizce turkce ceviri | ikinci el is makinalari

Visual Basic :: How To Merge Icons In VB5?

December 11, 2012 by icondrawer.com (not verified), 1 year 37 weeks ago
Comment id: 25063

By WebOsPublisher

Vector EPS clipart: Man icon . High quality Royalty-Free vector clipart available for instant download.
Man icon - vector EPS clipart
body margin: 0px;
* font-family: Verdana, Arial, Helvetica; line-height: 1.5;
body, td, p, div, span, input, select, textarea font-size: 12px;
h1 font-size: 15px; color: #5F5F5F; font-weight: bold; margin: 2pt;
h2 font-size: 14px; color: #5F5F5F; font-weight: bold; margin: 2pt;
a color: #073a8d;
.message font-weight: bold; color: #CC0000; padding: 3pt; border: 1px solid #CC0000; background-color: #FFFFCC
Worlds best Royalty-Free & High Quality Vector Images
Search for vector images: vinyl-ready
all
clipart
flags & arms
International:
1-800-470-7183 Help
About
Vector Images Directory
Vector clipart CDs
Partnership
License Terms
Sign Up now!
в—ў Member Account
Login
Password
Not registered?
Lost Password?
Find us on Facebook ›
Support / Help:
support@vector-images.com
›› Online HELP
Toll Free Phone: 1-800-470-7183(7:00 am - 3:00 pm EST)Toll Free Fax: 1-866-595-7259
Last updates
VI Updates
› New vector images on Vector-Images.com
Updates on Cliparto
› New high resolution photos and vector graphics on Cliparto
Man icon - vector EPS clipart
more vector clipart for: Man icon »
› Add to LightBox
Vector Clipart ID: c99718color vector clipart
Image title: Man icon Type of vectorization: non-vinyl (not cuttable) vector file
Artist: aarrows / ClipartoDownload cost: $2.45
OR just from $0.20 per vector image by subscription!
License: StandardNeed Extended License?Available vector graphic file formats and file size:
EPSEPS380.9 kb
JPEG/JPG**4569x4569 px954.2 kb
EPS, AI, CDR, WMF - scalable vector grafic formats; JPG - unscalable raster format. Other graphic formats are available upon request.Instant download access:Download option is available for registered users only. Please log in or Sign Up.Download cost is deducted from customer's account on Vector-Images.com when download link is being clicked. By downloading an image you confirm that you are agree with terms of Standard Royalty-Free license.Image Upload / Last Update: 2012-02-26Similar vector imagesby keywords: › man › icon
› Male and female symbols
› Man with ball as US flag
› Group of three mans in ties and round glasses
› Icons for gadget
› Gadget icons set
› 121 pictograms
› Equestrian sport
› Western Icons Set
› powerful man
› Horse racing silhouettes
© 2002-2012 CMPT Graphics. All rights reserved.
Terms of Licenses | Terms of website use | Privacy Policy | Sell vector images

What an extremely inspiring

February 27, 2013 by Glennis Shoff (not verified), 1 year 26 weeks ago
Comment id: 26438

What an extremely inspiring article. I am truly impressed by your posts. You post very helpful information. Keep it up. Keep blogging. Really looking forward to seeing your next post.

Lane Bonillo

I seriously like to fuck men,

March 28, 2013 by Anonymous (not verified), 1 year 22 weeks ago
Comment id: 26928

I seriously like to fuck men, hard, fast and with as much abandonment as is possible.
http://iliketofuckmen.com

I like god, all animals and

March 28, 2013 by Anonymous (not verified), 1 year 22 weeks ago
Comment id: 26929

I like god, all animals and sunsets, i like to pray
Visit W3Schools

The modern version control

August 8, 2013 by cluding (not verified), 1 year 3 weeks ago
Comment id: 28590

The modern version control systems including even CVS provide the excellent feature to aid the code reviews.
192.168.1.1
192.168.0.1
192.168.2.1

This type of story definitely

March 7, 2014 by acklog (not verified), 25 weeks 3 days ago
Comment id: 31960

This type of story definitely doesn't belong on the product backlog but would be a perfect task that could exist.192.168.1.1

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <b> <i> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <br> <blockquote>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. Beside the tag style "<foo>" it is also possible to use "[foo]".

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.

Best of AgileSoftwareDevelopment.com