« IE7 RC1 can't update Password Protected ... | Main | Coding4Fun Hardware Boneyard - Using the... »

Hanselminutes Podcast 32 - Mock Objects

Posted 2006-09-13 08:46 PM in Podcast | Tools.

My thirty-second Podcast is up. This episode is about Mock Objects - what they are, and should you care?

We're listed in the iTunes Podcast Directory, so I encourage you to subscribe with a single click (two in Firefox) with the button below. For those of you on slower connections there are lo-fi and torrent-based versions as well.

Subscribe: Feed-icon-16x16 Subscribe to my Podcast in iTunes

Links from the show are also always on the show site. Do also remember the archives are always up and they have PDF Transcripts, a little known feature that show up a few weeks after each show.

Links from the Show

RhinoMocks (i0t)
TypeMock (i5b)
Ayende Rahien (i5d)
EasyMock.NET (i57)
Example of using TypeMock (i5c)
IBM - Unit Testing with Mocks (i0p)
NMock2 (i58)
NUnit2 Mocks (i5e)
NMock vs. NMock2 Comparison (i59)
Roy Osherove on NMock2 (i5a)
We have a new sponsor this show, Aspose, the .NET and Java Component Publisher. They produce a wide variety of components with versions in both .NET and Java. Do check out their Aspose Demo Downloads as they have a huge catalog of tools to explore.

Our sponsors are Apose, CodeSmith Tools and the .NET Dev Journal. There's a $100 off CodeSmith coupon for Hanselminutes listeners - it's coupon code HM100. Spread the word, now's the time to buy.

As I've said before this show comes to you with the audio expertise and stewardship of Carl Franklin. The name comes from Travis Illig, but the goal of the show is simple. Avoid wasting the listener's time. (and make the commute less boring)

  • The basic MP3 feed is here, and the iPod friendly one is here. There's a number of other ways you can get it (streaming, straight download, etc) that are all up on the site just below the fold. I use iTunes, myself, to listen to most podcasts, but I also use FeedDemon and it's built in support.
  • Note that for now, because of bandwidth constraints, the feeds always have just the current show. If you want to get an old show (and because many Podcasting Clients aren't smart enough to not download the file more than once) you can always find them at http://www.hanselminutes.com.
  • I have, and will, also include the enclosures to this feed you're reading, so if you're already subscribed to ComputerZen and you're not interested in cluttering your life with another feed, you have the choice to get the 'cast as well.
  • If there's a topic you'd like to hear, perhaps one that is better spoken than presented on a blog, or a great tool you can't live without, contact me and I'll get it in the queue!

Enjoy. Who knows what'll happen in the next show?

Tracked by:
"How to Embed Data with Unit Tests" (Patrick Altman) [Trackback]
"Testing Code That Invokes WebServices" (Commonality) [Trackback]
"Mocking ArcObjects with NMock" (Dave Bouwman) [Trackback]
"Mocking ArcObjects with NMock" (ArcEnterprise Blog) [Trackback]


Wednesday, September 13, 2006 10:41:26 PM (Pacific Standard Time, UTC-08:00)
Thirty SECOND show? Wow! I can't imagine how you're going to cover a subject like Mock Objects in 30 seconds. I'm impressed! ;-)
Wednesday, September 13, 2006 10:50:33 PM (Pacific Standard Time, UTC-08:00)
Ian - :P

"Mock Objects are neat. Use them. Use them again and again."

Boom, that was like 14 seconds.
Scott Hanselman
Thursday, September 14, 2006 2:09:00 AM (Pacific Standard Time, UTC-08:00)
Scott,

I've been using Rhino for several months now, and feel quite comfortable with the toolset.

You mention during this podcast that it's sometimes difficult to get around the "virtual method" requirement in order to mock an object. The solution that I've implemented is to add conditional compilation statements around the declaration of methods that I intend to mock that I want to be sealed or final in the production release of my code.

Jeff Fritz
Thursday, September 14, 2006 3:27:58 AM (Pacific Standard Time, UTC-08:00)
I've been using Rhino Mocks lately as well and I'm fairly happy with it. The virtual method requirement hasn't caused me too much grief, because mostly I need it when I'm mocking interface implementations (of which I'm using a lot lately, coupled with Windsor Container as the IoC implementation). Seems to work just fine for me, and the way expectations are expressed in Rhino suits me.
Thursday, September 14, 2006 6:15:23 AM (Pacific Standard Time, UTC-08:00)
I like to mock objects. It makes me feel superior.
Jason Scheuerman
Thursday, September 14, 2006 7:20:44 AM (Pacific Standard Time, UTC-08:00)
Scott:

(Sorry for the email spam, I now see this comment section, so posting here)

Enjoyed the show. As always, picked up some previously unknown technologies – I knew about NUnit and NMock (and DotNetMock, which you didn’t mention), but not about Rhino nor TypeMock. Can’t wait to try TypeMock, could be really helpful for me.

A couple of points I thought could have been added for clarity
1. Mock objects are not for mocking your test subject, but its dependencies.
2. A useful way of comparing normal unit testing with the use of mock objects is that normally you run tests, then dissect your objects and make sure things went right (the atom smasher approach). Mock objects allow you to test the actual interactions of objects. This is another benefit of mocks that I didn’t think really made come through in the discussion.

ServiceStub [Fowler, P of EAA] is a pattern that can be used as an alternative to mock objects – probably not suitable for the podcast, but I do hear it used instead of mock objects. But it places more requirements on your code.
Dave P.
Thursday, September 14, 2006 8:08:04 AM (Pacific Standard Time, UTC-08:00)
Dave,

I see ServiceStub as being a pattern more useful in functional/performance testing than on unit tests, but it does have a purpose and the basic idea is certainly the same (or at least pretty close) to the mocking idea, anyway.
Thursday, September 14, 2006 4:02:25 PM (Pacific Standard Time, UTC-08:00)
Tomas:

Personally, I agree with you, but it's a philosophical thing. Some people are definitely out there using ServiceStub for unit testing (including Fowler, who said in an interview I read something to the effect of "we use service stubs instead of mock objects. Nothing wrong with mock objects, but we do our testing differently.")

I think the point is that ServiceStub is used to replace an expensive and hard-to-work-with service (e.g. external, database, etc.) to enable testing of dependent classes. Mock objects give you that, but a whole lot more to boot (like interaction validation)

It's worth reading Fowler's article "Mocks Aren't Stubs"

Interesting to note that he suggests using mock objects to implement stubs.
Dave
Comments are closed.

Contact

Sponsors

Hosting By

Hot Topics

Tags

Calendar

<November 2009>
SunMonTueWedThuFriSat
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

Archives

November, 2009 (5)
October, 2009 (19)
September, 2009 (11)
August, 2009 (12)
July, 2009 (21)
June, 2009 (26)
May, 2009 (16)
April, 2009 (13)
March, 2009 (17)
February, 2009 (17)
January, 2009 (18)
December, 2008 (32)
November, 2008 (17)
October, 2008 (22)
September, 2008 (16)
August, 2008 (14)
July, 2008 (25)
June, 2008 (19)
May, 2008 (17)
April, 2008 (17)
March, 2008 (26)
February, 2008 (21)
January, 2008 (28)
December, 2007 (19)
November, 2007 (17)
October, 2007 (31)
September, 2007 (39)
August, 2007 (37)
July, 2007 (43)
June, 2007 (37)
May, 2007 (32)
April, 2007 (38)
March, 2007 (29)
February, 2007 (46)
January, 2007 (31)
December, 2006 (27)
November, 2006 (31)
October, 2006 (32)
September, 2006 (39)
August, 2006 (34)
July, 2006 (40)
June, 2006 (18)
May, 2006 (31)
April, 2006 (34)
March, 2006 (30)
February, 2006 (38)
January, 2006 (44)
December, 2005 (19)
November, 2005 (34)
October, 2005 (24)
September, 2005 (37)
August, 2005 (20)
July, 2005 (24)
June, 2005 (33)
May, 2005 (16)
April, 2005 (22)
March, 2005 (34)
February, 2005 (15)
January, 2005 (37)
December, 2004 (28)
November, 2004 (30)
October, 2004 (34)
September, 2004 (22)
August, 2004 (34)
July, 2004 (18)
June, 2004 (64)
May, 2004 (49)
April, 2004 (21)
March, 2004 (29)
February, 2004 (29)
January, 2004 (36)
December, 2003 (25)
November, 2003 (24)
October, 2003 (59)
September, 2003 (42)
August, 2003 (24)
July, 2003 (44)
June, 2003 (29)
May, 2003 (21)
April, 2003 (30)
March, 2003 (27)
February, 2003 (47)
January, 2003 (50)
December, 2002 (31)
November, 2002 (38)
October, 2002 (44)
September, 2002 (15)
May, 2002 (2)
April, 2002 (4)

Google Ads