<html>
<head>
<style>
P
{
margin:0px;
padding:0px
}
body
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body>I'm currently reading a&nbsp;draft manuscript&nbsp;of 'XUnit Test Patterns' primarily to answer this sort of question. It looks like most of the content for this book is already online. The sections that would be most interesting in this context would be <A href="http://xunitpatterns.com/Using%20Test%20Doubles.html">http://xunitpatterns.com/Using%20Test%20Doubles.html</A>&nbsp;and <A href="http://xunitpatterns.com/Test%20Double%20Patterns.html">http://xunitpatterns.com/Test%20Double%20Patterns.html</A>.<BR>
&nbsp;<BR>
The use (or not use) of doubles is something he considers a 'strategy', that is, a decision that is painful to change later. Depending on how big the project will be simpler now might be a big headache later.<BR>
&nbsp;<BR>
Further relevant quoting would be that Benji's example of why not using a double would be a 'Fragile Test Smell' (<A href="http://xunitpatterns.com/Fragile%20Test.html">http://xunitpatterns.com/Fragile%20Test.html</A>).<BR>
&nbsp;<BR>
-adam<BR><BR>
<BLOCKQUOTE>
<HR id=EC_stopSpelling>
From: lucks@FAS.HARVARD.EDU<BR>Date: Tue, 24 Apr 2007 16:52:31 -0400<BR>To: benji@benjiyork.com<BR>CC: testing-in-python@lists.idyll.org<BR>Subject: Re: [TIP] Mock objects in testing object composition?<BR><BR>Many thanks Benji and Paul.
<DIV><BR class=EC_khtml-block-placeholder></DIV>
<DIV>Looks like simpler is better.&nbsp;&nbsp;So when are mock objects useful?</DIV>
<DIV><BR class=EC_khtml-block-placeholder></DIV>
<DIV>Julius</DIV>
<DIV><BR>
<DIV><SPAN class=EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate">
<DIV>-----------------------------------------------------</DIV>
<DIV><A href="http://openwetware.org/wiki/User:Lucks" target=_blank>http://openwetware.org/wiki/User:Lucks</A></DIV>
<DIV>-----------------------------------------------------</DIV>
<DIV><BR class=EC_khtml-block-placeholder></DIV><BR class=EC_Apple-interchange-newline></SPAN></DIV><BR>
<DIV>
<DIV>On Apr 24, 2007, at 4:45 PM, Benji York wrote:</DIV><BR class=EC_Apple-interchange-newline>
<BLOCKQUOTE>
<DIV style="MARGIN-BOTTOM: 0px; MARGIN-LEFT: 0px; MARGIN-RIGHT: 0px">Julius Lucks wrote:</DIV>
<BLOCKQUOTE>
<DIV style="MARGIN-BOTTOM: 0px; MARGIN-LEFT: 0px; MARGIN-RIGHT: 0px">I would like to separate Grid tests from dependance on Tile so that later on down the road when I change the Tile class and break it, then my Grid tests don't start to fail for this reason.<SPAN class=EC_Apple-converted-space>&nbsp; </SPAN>Is this not a good way of thinking?</DIV></BLOCKQUOTE>
<DIV style="MIN-HEIGHT: 14px; MARGIN-BOTTOM: 0px; MARGIN-LEFT: 0px; MARGIN-RIGHT: 0px"><BR></DIV>
<DIV style="MARGIN-BOTTOM: 0px; MARGIN-LEFT: 0px; MARGIN-RIGHT: 0px">It sounds ideal, but like so many ideals its cost is likely greater than the benefit.</DIV>
<DIV style="MIN-HEIGHT: 14px; MARGIN-BOTTOM: 0px; MARGIN-LEFT: 0px; MARGIN-RIGHT: 0px"><BR></DIV>
<DIV style="MARGIN-BOTTOM: 0px; MARGIN-LEFT: 0px; MARGIN-RIGHT: 0px">I wouldn't worry about it.<SPAN class=EC_Apple-converted-space>&nbsp; </SPAN>One day your Tile and Grid tests start failing, you look at one or the other and realize pretty quickly that Tile is at fault, you fix Tile and Grid is happy too.<SPAN class=EC_Apple-converted-space>&nbsp; </SPAN>Not to mention that you making changes to Tile is what caused the tests to start failing, so you'll have a pretty good idea what happened.</DIV>
<DIV style="MARGIN-BOTTOM: 0px; MARGIN-LEFT: 0px; MARGIN-RIGHT: 0px">--<SPAN class=EC_Apple-converted-space>&nbsp;</SPAN></DIV>
<DIV style="MARGIN-BOTTOM: 0px; MARGIN-LEFT: 0px; MARGIN-RIGHT: 0px">Benji York</DIV>
<DIV style="MARGIN-BOTTOM: 0px; MARGIN-LEFT: 0px; MARGIN-RIGHT: 0px"><A href="http://benjiyork.com/" target=_blank>http://benjiyork.com</A></DIV></BLOCKQUOTE></DIV><BR></DIV></BLOCKQUOTE><br /><hr />Connect to the next generation of MSN Messenger   <a href='http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline' target='_new'>Get it now! </a></body>
</html>