Mocks, fakes and stubs

by mheydt 7. July 2009 13:57 >
Listening to Hanselminutes "The Art of Unit Testing with Roy Osherove" and there are a few definitions being discussed that I think are useful to know...

  • Fake
Fakes are objects that look like something but are fake, and can be stubs or mocks depending upon the usage.
  • Stub
Stubs help a test execute, and typically contain "fake" data, used to get a test to run.
  • Mock
Mocks are asserted against to determine if a test has passed.  Basically it is a fake object used to make a test to execute.  Typically a mock also has behavior instead of just data.

More is discussed in Roy's book "The Art of Unit Testing", which I have, but have not read yet.

Tags:

TDD

blog comments powered by Disqus

about the author

I'm a .NET, XAML, and iOS polyglot that loves playing with new things and making cool and innovative stuff.  I am also a Mac junkie.

I am Principal Technologist for SunGard Global Services in NYC, in their Advanced Technologies practice, and I work extensively with SunGard's energy and financial customers.

Note the the posting on this blog are my own and do not represent the position, strategies or opinions of SGS.

twitter

I can't stop thinking big!
Sunday 1:08AM via WindowsLive
Just watched Moneyball. That's my pick for best movie this year.
Saturday 3:51PM via WindowsLive
@vincebelpiede: Report: Skype For Windows Phone Beta Imminent http://t.co/KYNjgg1L#mhtnd
Wednesday 8:39AM via Twitter for Mac
@mashable: Kinect Fusion Will Turn Gaming (and More) Into a 3D Fun House - http://t.co/Ihrq2fY2#mhtnd
Wednesday 8:39AM via Twitter for Mac
New Kinect SDK: http://t.co/57MvA5L5 #mhtnd
Wednesday 8:39AM via Twitter for Mac
Follow me on Twitter

recent comments

None

month list