<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' version='2.0'><channel><atom:id>tag:blogger.com,1999:blog-34908752</atom:id><lastBuildDate>Tue, 30 Jun 2009 06:46:46 +0000</lastBuildDate><title>Mock Objects</title><description>About Mock Objects, a technique for improving the design of code within Test-Driven Development</description><link>http://www.mockobjects.com/</link><managingEditor>noreply@blogger.com (Steve Freeman)</managingEditor><generator>Blogger</generator><openSearch:totalResults>76</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-34908752.post-337741654357909160</guid><pubDate>Thu, 11 Jun 2009 20:24:00 +0000</pubDate><atom:updated>2009-06-11T21:27:17.393+01:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>publications</category><category domain='http://www.blogger.com/atom/ns#'>news</category><title>Using Mocks and Tests to Design Role-Based Objects</title><description>&lt;p&gt;Isaiah Perumalla has had a &lt;a href="http://msdn.microsoft.com/magazine/dd882516.aspx"&gt;paper&lt;/a&gt; published by MSDN. They trimmed it a bit, so we're hosting the original &lt;a href="http://www.mockobjects.com/files/usingmocksandtests.pdf"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34908752-337741654357909160?l=www.mockobjects.com%2Findex.html'/&gt;&lt;/div&gt;</description><link>http://www.mockobjects.com/2009/06/using-mocks-and-tests-to-design-role.html</link><author>noreply@blogger.com (Steve Freeman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-34908752.post-2744820081195496219</guid><pubDate>Thu, 21 May 2009 21:30:00 +0000</pubDate><atom:updated>2009-05-21T22:32:24.657+01:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>news</category><category domain='http://www.blogger.com/atom/ns#'>growing object-oriented software</category><category domain='http://www.blogger.com/atom/ns#'>book</category><title>Another update to the book</title><description>We've gone very quiet for a while because we've been busy writing (and rewriting, and rewriting). We've reworked some of the example, and done some substantial clean-up in parts III and IV. 

Let us know on the list what you think.&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34908752-2744820081195496219?l=www.mockobjects.com%2Findex.html'/&gt;&lt;/div&gt;</description><link>http://www.mockobjects.com/2009/05/another-update-to-book.html</link><author>noreply@blogger.com (Steve Freeman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>4</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-34908752.post-5950926793103686499</guid><pubDate>Thu, 02 Apr 2009 21:43:00 +0000</pubDate><atom:updated>2009-04-02T22:46:04.086+01:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>growing object-oriented software</category><category domain='http://www.blogger.com/atom/ns#'>book</category><title>Book. More and more</title><description>As the deadlines approach&amp;hellip;

We've published new chapters: another chapter in the example on handling failures, one on our approach to Object-Oriented design and one on how that relates to Mock Objects, and one on testing asynchronous code.

Enjoy&amp;mdash;and comment.&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34908752-5950926793103686499?l=www.mockobjects.com%2Findex.html'/&gt;&lt;/div&gt;</description><link>http://www.mockobjects.com/2009/04/book-more-and-more.html</link><author>noreply@blogger.com (Steve Freeman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>2</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-34908752.post-3904585910047796341</guid><pubDate>Fri, 27 Mar 2009 11:05:00 +0000</pubDate><atom:updated>2009-03-27T11:10:10.093Z</atom:updated><category domain='http://www.blogger.com/atom/ns#'>news</category><category domain='http://www.blogger.com/atom/ns#'>growing object-oriented software</category><category domain='http://www.blogger.com/atom/ns#'>book</category><title>Book. More chapters posted</title><description>We've been quiet for a while because we've been trying to make progress with &lt;a href="http://www.mockobjects.com/book"&gt;the book&lt;/a&gt;. To let you know how we're doing, we've just posted some more draft chapters: there's more from the extended example, one on how to maintain ongoing TDD, and one on how to cope with threading.

As always comments welcome, and join the &lt;a href="http://tech.groups.yahoo.com/group/growing-oo-software-guided-by-tests/"&gt;discussion list&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34908752-3904585910047796341?l=www.mockobjects.com%2Findex.html'/&gt;&lt;/div&gt;</description><link>http://www.mockobjects.com/2009/03/book-more-chapters-posted.html</link><author>noreply@blogger.com (Steve Freeman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-34908752.post-4930483981012318712</guid><pubDate>Sat, 13 Dec 2008 20:16:00 +0000</pubDate><atom:updated>2008-12-13T20:18:13.612Z</atom:updated><category domain='http://www.blogger.com/atom/ns#'>mocks in action</category><category domain='http://www.blogger.com/atom/ns#'>news</category><title>googlemock</title><description>&lt;p&gt;Google have just announced googlemock, their C++ mocking framework. More details at &lt;a href="http://code.google.com/p/googlemock/"&gt;http://code.google.com/p/googlemock/&lt;/a&gt;. It looks like they've done a lot of work.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34908752-4930483981012318712?l=www.mockobjects.com%2Findex.html'/&gt;&lt;/div&gt;</description><link>http://www.mockobjects.com/2008/12/googlemock.html</link><author>noreply@blogger.com (Steve Freeman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-34908752.post-8036856493562093753</guid><pubDate>Thu, 27 Nov 2008 17:07:00 +0000</pubDate><atom:updated>2008-11-27T17:17:52.762Z</atom:updated><category domain='http://www.blogger.com/atom/ns#'>explanation</category><category domain='http://www.blogger.com/atom/ns#'>design</category><title>Only mock types you own (revisited)</title><description>&lt;p&gt;There was a brief discussion on the &lt;a href="http://archive.hausfoundation.org/lists/org.codehaus.jmock.user/msg/492E6E5D.2060209@historicalengineering.com"&gt;JMock mailing list&lt;/a&gt; recently where we helped out a new user. In the process, we noticed that he was mocking Java &lt;code&gt;Set&lt;/code&gt;, which we tend to avoid, because it's not a type that we own&amp;mdash;it's not in the domain of the problem we're trying to solve. The way I put it was,&lt;/p&gt;

&lt;blockquote&gt;We see a lot of people using, for example, &lt;code&gt;List&amp;lt;House&amp;gt;&lt;/code&gt; when what they actually mean is &lt;code&gt;Street&lt;/code&gt;. We try to use types we own that represent concepts in the domain, rather than built-in or library types which we keep for implementing these domain types. If the domain types are defined in terms of roles, then they're often appropriate for mocking.&lt;/blockquote&gt;

&lt;p&gt;Isiah followed up with an &lt;a href="http://isaiahperumalla.wordpress.com/2008/05/28/test-driven-design-using-mocks-lessons-learnt-part-2/"&gt;old post&lt;/a&gt; of his own.&lt;/p&gt;

&lt;p&gt;I think we have a satisfied customer:&lt;/p&gt;

&lt;blockquote&gt;Thank you Steve and Isiah, I think I just took a large step in the world  of TDD.&lt;/blockquote&gt;

&lt;p&gt;It's nice when that happens...&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34908752-8036856493562093753?l=www.mockobjects.com%2Findex.html'/&gt;&lt;/div&gt;</description><link>http://www.mockobjects.com/2008/11/only-mock-types-you-own-revisited.html</link><author>noreply@blogger.com (Steve Freeman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-34908752.post-3204768351602030738</guid><pubDate>Thu, 27 Nov 2008 17:03:00 +0000</pubDate><atom:updated>2008-11-27T17:06:14.822Z</atom:updated><category domain='http://www.blogger.com/atom/ns#'>growing object-oriented software</category><category domain='http://www.blogger.com/atom/ns#'>book</category><title>More example, reworking the process</title><description>We've posted some more chapters from the long worked example. We've also been reworking the material on the Process of TDD. Take a &lt;a href="http://www.mockobjects.com/book"&gt;look&lt;/a&gt;, and comments are always welcome.&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34908752-3204768351602030738?l=www.mockobjects.com%2Findex.html'/&gt;&lt;/div&gt;</description><link>http://www.mockobjects.com/2008/11/more-example-reworking-process.html</link><author>noreply@blogger.com (Steve Freeman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>2</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-34908752.post-6215585331821856039</guid><pubDate>Thu, 25 Sep 2008 19:30:00 +0000</pubDate><atom:updated>2008-09-25T20:32:32.777+01:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>mocks in action</category><category domain='http://www.blogger.com/atom/ns#'>design</category><category domain='http://www.blogger.com/atom/ns#'>testability</category><title>TDD. Killing the messenger?</title><description>&lt;p&gt;Are we really doomed to another generation of procedural code masquerading as objects?&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/rosherove/archive/2008/09/20/goodbye-mocks-farewell-stubs.aspx"&gt;Roy Osherove&lt;/a&gt; has come out against "mocking" in favour of "isolating". One reading of his point is that mocking is just too hard for the bulk of the programmers he sees. Perhaps that's true (the others developers who discovered the technique are all very good) but I hope not (either that or I should increase my rates). And I'm pleased to see &lt;a href="http://ayende.com/Blog/archive/2008/09/23/cuddling-is-consider-harmful.aspx"&gt;Oren&lt;/a&gt;, for one, has responded.&lt;/p&gt;

&lt;p&gt;Roy addresses important issues which we need to think about, but we shouldn't pitch the whole industry at the level of its least skilled members; I've spent too much of my life cleaning up code that should never have been written in the first place. In the meantime, if his staff don't understand basic Object-Orientation, then that's what he should be teaching first, with a sprinkling of acceptance testing on top for regression.
&lt;/p&gt;

&lt;p&gt;Reading the post and its comments again, I see repeated "Doctor, it hurts when I do that" moments. Roy's response is to back off interaction testing, but that misses the experience and insight that led us into this situation in the first place. My call is that, like Object-Orientation, the technique is widely misunderstood, which is why the same objections keep coming back. This isn't a comfortable position.
&lt;/p&gt;

&lt;p&gt;To take the most obvious example, as Roy says himself, record/replay just doesn't cut it. That's why we've never supported it. It's easy to start with, but then my experience is that it encourages unmaintainable tests. It focusses the language of a test on the accident of the current implementation, rather than on the significant relationships between objects. It also encourages asserting every interaction, which leads to just the sort of problem that everyone complains about, brittle overspecified tests. That's why we don't do it, we only assert interactions that can affect the world around the object under test and stub the rest.
&lt;/p&gt;

&lt;p&gt;The other disaster (yes, I think record/replay has been a disaster) was our early attempt to mock the entire Java libraries. Apart from being unrealistic, it sent entirely the wrong message, emphasising isolating from databases over guiding the design. Later, Joe Walnes coined the notion of "Only Mock types you own", which really helped some people get the idea.
&lt;/p&gt;

&lt;p&gt;
As someone posted somewhere in this exchange, TDD will punish you if you don't understand design. I'd argue that that's what it's &lt;em&gt;for&lt;/em&gt;, and that it's essential to listen to what the tests are saying rather than turning down the volume.
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34908752-6215585331821856039?l=www.mockobjects.com%2Findex.html'/&gt;&lt;/div&gt;</description><link>http://www.mockobjects.com/2008/09/tdd-killing-messenger.html</link><author>noreply@blogger.com (Steve Freeman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>2</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-34908752.post-1866667085705153978</guid><pubDate>Tue, 23 Sep 2008 07:44:00 +0000</pubDate><atom:updated>2008-09-23T19:19:13.152+01:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>growing object-oriented software</category><category domain='http://www.blogger.com/atom/ns#'>book</category><title>Reordering chapters</title><description>&lt;p&gt;We've cut down the introduction and moved some of the material into a new section, &lt;em&gt;Examining the Process&lt;/em&gt;. &lt;a href="/book"&gt;Check it out and let us know what you think&lt;/a&gt;. More content to follow soon.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34908752-1866667085705153978?l=www.mockobjects.com%2Findex.html'/&gt;&lt;/div&gt;</description><link>http://www.mockobjects.com/2008/09/reordering-chapters.html</link><author>noreply@blogger.com (Steve Freeman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-34908752.post-2018949831318665434</guid><pubDate>Thu, 04 Sep 2008 07:03:00 +0000</pubDate><atom:updated>2008-09-23T08:43:52.450+01:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>growing object-oriented software</category><category domain='http://www.blogger.com/atom/ns#'>book</category><title>Chapter 9. Passing the First Test</title><description>&lt;p&gt;We've posted &lt;a href="http://www.mockobjects.com/book/example.passing-the-first-test.html"&gt;another episode&lt;/a&gt; from our long worked example.&lt;/p&gt;

&lt;blockquote&gt;At the start of every test run, we need our test script to start up the Openfire server, create accounts for the Sniper and Auction, and then run the tests. Each test will start instances of the application and fake auction and test their communication through the server.&lt;/blockquote&gt;

&lt;p&gt;We've also made some changes in response to comments on &lt;a href="http://www.mockobjects.com/book/example.passing-the-first-test.html"&gt;the discussion list&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34908752-2018949831318665434?l=www.mockobjects.com%2Findex.html'/&gt;&lt;/div&gt;</description><link>http://www.mockobjects.com/2008/09/chapter-9-passing-first-test.html</link><author>noreply@blogger.com (Steve Freeman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-34908752.post-564167118864406992</guid><pubDate>Thu, 28 Aug 2008 09:44:00 +0000</pubDate><atom:updated>2008-08-28T10:47:46.592+01:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>growing object-oriented software</category><category domain='http://www.blogger.com/atom/ns#'>book</category><title>Long Worked Example</title><description>&lt;p&gt;We've posted the first couple of chapters of the long worked example from our book, &lt;a href="/book"&gt;Growing Object Oriented Software Guided by Tests&lt;/a&gt;.  It's work in progress: some of the diagrams have not been finished quite yet.  As ever, feedback is welcome via the &lt;a href="http://tech.groups.yahoo.com/group/growing-oo-software-guided-by-tests/"&gt;discussion group&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34908752-564167118864406992?l=www.mockobjects.com%2Findex.html'/&gt;&lt;/div&gt;</description><link>http://www.mockobjects.com/2008/08/long-worked-example.html</link><author>noreply@blogger.com (Nat Pryce)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-34908752.post-1932381629602196613</guid><pubDate>Thu, 21 Aug 2008 22:03:00 +0000</pubDate><atom:updated>2008-08-21T23:07:06.724+01:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>growing object-oriented software</category><category domain='http://www.blogger.com/atom/ns#'>book</category><title>New Table of Contents Online</title><description>We've posted the new &lt;a href="/book/index.html"&gt;Table of Contents&lt;/a&gt;.  From now on, we'll update this as we put chapters online and shuffle content about.&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34908752-1932381629602196613?l=www.mockobjects.com%2Findex.html'/&gt;&lt;/div&gt;</description><link>http://www.mockobjects.com/2008/08/new-table-of-contents-online.html</link><author>noreply@blogger.com (Nat Pryce)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-34908752.post-3832507931748878177</guid><pubDate>Thu, 21 Aug 2008 12:59:00 +0000</pubDate><atom:updated>2008-08-26T23:20:47.087+01:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>growing object-oriented software</category><category domain='http://www.blogger.com/atom/ns#'>book</category><title>Chapter 5. An Introduction to the Tools</title><description>&lt;p&gt;We have put a new chapter of the &lt;a href="http://www.mockobjects.com/2008/07/growing-object-oriented-software-guided.html"&gt;book&lt;/a&gt; online: &lt;a href="/book/tdd-tools-api-intro.html"&gt;Chapter 5. An Introduction to the Tools&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;What happened to chapter 4?  We've moved some chapters around after reading people's comments in the &lt;a href="http://tech.groups.yahoo.com/group/growing-oo-software-guided-by-tests/"&gt;discussion group&lt;/a&gt; and will publish chapter 4 as soon as we've finished it and polished it up.  We'll put the new table of contents up ASAP.&lt;/p&gt;

&lt;p&gt;You can give comments and feedback via the &lt;a href="http://tech.groups.yahoo.com/group/growing-oo-software-guided-by-tests/"&gt;discussion group&lt;/a&gt; or as blog comments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; explained why we are only giving a cursory introduction to the tools.  Improve explanation of why we chose JUnit and include where you can download it from.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34908752-3832507931748878177?l=www.mockobjects.com%2Findex.html'/&gt;&lt;/div&gt;</description><link>http://www.mockobjects.com/2008/08/chapter-5-introduction-to-tools.html</link><author>noreply@blogger.com (Nat Pryce)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-34908752.post-1327875878353912862</guid><pubDate>Wed, 06 Aug 2008 10:52:00 +0000</pubDate><atom:updated>2008-08-26T23:22:09.204+01:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>growing object-oriented software</category><category domain='http://www.blogger.com/atom/ns#'>book</category><title>Chapter 3. Kick-Starting the Test-Driven Cycle</title><description>&lt;p&gt;We have put a new chapter of the &lt;a href="http://www.mockobjects.com/2008/07/growing-object-oriented-software-guided.html"&gt;book&lt;/a&gt; online: &lt;a href="/book/kickstarting-tdd.html"&gt;Chapter 3. Kick-Starting the Test-Driven Cycle&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You can give comments and feedback via the &lt;a href="http://tech.groups.yahoo.com/group/growing-oo-software-guided-by-tests/"&gt;discussion group&lt;/a&gt; or as blog comments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; added a sidebar about kick-starting "brownfield" development.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34908752-1327875878353912862?l=www.mockobjects.com%2Findex.html'/&gt;&lt;/div&gt;</description><link>http://www.mockobjects.com/2008/08/chapter-3-kick-starting-test-driven.html</link><author>noreply@blogger.com (Nat Pryce)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-34908752.post-1803261065041684719</guid><pubDate>Fri, 25 Jul 2008 11:50:00 +0000</pubDate><atom:updated>2008-08-07T11:14:00.276+01:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>growing object-oriented software</category><category domain='http://www.blogger.com/atom/ns#'>book</category><title>Chapter 2. Test-Driven Development with Objects</title><description>&lt;p&gt;We are now publishing chapters of our book, &lt;a href="http://www.mockobjects.com/2008/07/growing-object-oriented-software-guided.html"&gt;Growing Object-Oriented Software Guided by Tests&lt;/a&gt; in a separate section of the site. We will publish news about new content in the blog but will not include the entire contents of each chapter as blog posts.&lt;/p&gt;
&lt;p&gt;We have updated Chapter 2, &lt;a href="/book/tdd-with-objects-intro.html"&gt;Test-Driven Development with Objects&lt;/a&gt; in response to feedback from blog comments and the &lt;a href="http://tech.groups.yahoo.com/group/growing-oo-software-guided-by-tests/"&gt;discussion group&lt;/a&gt; and improved some of the diagrams.  More comments are always welcome.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34908752-1803261065041684719?l=www.mockobjects.com%2Findex.html'/&gt;&lt;/div&gt;</description><link>http://www.mockobjects.com/2008/07/chapter-2-test-driven-development-with.html</link><author>noreply@blogger.com (Steve Freeman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-34908752.post-482063379702960285</guid><pubDate>Wed, 16 Jul 2008 12:13:00 +0000</pubDate><atom:updated>2008-07-16T13:16:47.975+01:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>growing object-oriented software</category><category domain='http://www.blogger.com/atom/ns#'>book</category><title>Book Discussion Group</title><description>&lt;p&gt;We have created a &lt;a href="http://tech.groups.yahoo.com/group/growing-oo-software-guided-by-tests/"&gt;Yahoo Group&lt;/a&gt; to host feedback and discussion about &lt;a href="http://www.mockobjects.com/2008/07/growing-object-oriented-software-guided.html"&gt;the book&lt;/a&gt; we're working on.  If you have &lt;em&gt;any&lt;/em&gt; feedback we'd love to hear from you.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34908752-482063379702960285?l=www.mockobjects.com%2Findex.html'/&gt;&lt;/div&gt;</description><link>http://www.mockobjects.com/2008/07/book-discussion-group.html</link><author>noreply@blogger.com (Nat Pryce)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-34908752.post-6456729585893974156</guid><pubDate>Mon, 14 Jul 2008 20:34:00 +0000</pubDate><atom:updated>2008-08-07T11:13:12.330+01:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>growing object-oriented software</category><category domain='http://www.blogger.com/atom/ns#'>book</category><title>Chapter 1. What's the point of Test-Driven Development?</title><description>&lt;p&gt;We are now publishing chapters of our book, &lt;a href="http://www.mockobjects.com/2008/07/growing-object-oriented-software-guided.html"&gt;Growing Object-Oriented Software Guided by Tests&lt;/a&gt; in a separate section of the site. We will publish news about new content in the blog but will not include the entire contents of each chapter as blog posts.&lt;/p&gt;

&lt;p&gt;We have updated Chapter 1, &lt;a href="/book/tdd-introduction.html"&gt;What's the Point of Test-Driven Development?&lt;/a&gt; in response to feedback from blog comments and the &lt;a href="http://tech.groups.yahoo.com/group/growing-oo-software-guided-by-tests/"&gt;discussion group&lt;/a&gt; and improved some of the diagrams.  More comments are always welcome.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34908752-6456729585893974156?l=www.mockobjects.com%2Findex.html'/&gt;&lt;/div&gt;</description><link>http://www.mockobjects.com/2008/07/chapter-point-of-test-driven.html</link><author>noreply@blogger.com (Steve Freeman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>7</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-34908752.post-177692450366289973</guid><pubDate>Sun, 13 Jul 2008 22:49:00 +0000</pubDate><atom:updated>2008-08-21T23:02:16.592+01:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>growing object-oriented software</category><category domain='http://www.blogger.com/atom/ns#'>book</category><title>Growing Object-Oriented Software, Guided by Tests</title><description>&lt;p&gt;We have been working for some time on a book about our approach to developing software test-first. We've been working at it long enough that we though it was time to start putting up some material to get some feedback which, after all, is a technique we go on and &lt;i&gt;on&lt;/i&gt; about. We'll start with chapters in HTML, then add some PDFs on the side as the material grows.&lt;/p&gt;
&lt;p&gt;Here's our opening.&lt;/p&gt;

&lt;h3&gt;A Deceptively Simple Idea&lt;/h3&gt;
&lt;blockquote&gt;Test-Driven Development (TDD) is a deceptively simple idea: write the tests for your code before writing the code itself. We say “deceptively simple” because this reversal fundamentally changes the role that testing plays in the development process and challenges the industry's assumptions about what testing is for. Testing is no longer just about keeping defects from the users, instead it's about helping the team to understand the features that the users need and to deliver those features reliably and predictably. When followed to its conclusions, TDD radically changes the way we develop software and, in our experience, dramatically improves the quality of the systems we build, in particular their reliability and their flexibility in response to new requirements. &lt;/blockquote&gt;

&lt;blockquote&gt;Test-Driven Development is widely used in “agile” software development methods. It is a core practice of Extreme Programming (XP) [Beck99], is recommended by Crystal Clear [Cockburn04] and often used in Scrum™ [SB01] projects. If you're going to work on an agile project, you will probably use TDD. We've used TDD on every agile project we've been involved in and have snuck the practises in to non-agile projects. We've even found it useful in pure R&amp;D projects that explore possibilities rather than meet customer needs and so have no need of the customer-facing project management practices of agile methods.&lt;/blockquote&gt;

&lt;h3&gt;More...&lt;/h3&gt;

&lt;p&gt;The &lt;a href="/book/index.html"&gt;Table of Contents&lt;/a&gt; links to the published chapters.&lt;/p&gt;

&lt;h3&gt;Feedback and Discussion&lt;/h3&gt;

&lt;p&gt;If you want to give us feedback on what we've written so far and see what other people think about it, please join the &lt;a href="http://tech.groups.yahoo.com/group/growing-oo-software-guided-by-tests/"&gt;discussion group&lt;/a&gt;.
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34908752-177692450366289973?l=www.mockobjects.com%2Findex.html'/&gt;&lt;/div&gt;</description><link>http://www.mockobjects.com/2008/07/growing-object-oriented-software-guided.html</link><author>noreply@blogger.com (Steve Freeman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>6</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-34908752.post-4742962158675255814</guid><pubDate>Thu, 05 Jun 2008 14:43:00 +0000</pubDate><atom:updated>2008-06-05T16:16:08.013+01:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>news</category><category domain='http://www.blogger.com/atom/ns#'>training</category><category domain='http://www.blogger.com/atom/ns#'>junit4</category><category domain='http://www.blogger.com/atom/ns#'>jmock</category><title>Public training courses?</title><description>&lt;p&gt;We've had a couple of inquiries about whether we will be running our &lt;a href="http://www.mockobjects.com/2008/05/learn-from-source.html"&gt;training course&lt;/a&gt; publicly. We hadn't planned to, but perhaps we should. We propose to run a two-day course priced at £1100 if booked less than 4 weeks ahead of the teach date, with a discount to £800 if booked earlier (plus UK VAT). The most obvious location is London (UK).&lt;/p&gt;

&lt;p&gt;If you think you might be interested (no commitment implied), please drop us an email at &lt;a href="mailto:public.course@mockobjects.com?subject=Prospective Course&amp;body=Name:%0ALondon is acceptable:%0APreferred other location:%0APreferred month for teach date:%0APossible number of attendees:%0ACoding experience (years):%0ATDD experience (years):%0AContact email:%0AContact phone:"&gt;public.course@mockobjects.com&lt;/a&gt; with this information:&lt;/p&gt;

&lt;pre&gt;
Name: 
London is acceptable:
Preferred other location:
Preferred month for teach date:
Possible number of attendees:
Coding experience (years): 
TDD experience (years):
Contact email:
Contact phone:
&lt;/pre&gt;

&lt;p&gt;We'll see if we can work something out&lt;/p&gt;

&lt;p style="font-size: 0.8em;"&gt;In case you're feeling nervous, whatever details we receive will be used only by us just to coordinate a course. We won't hassle you or pass them on to anyone else.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34908752-4742962158675255814?l=www.mockobjects.com%2Findex.html'/&gt;&lt;/div&gt;</description><link>http://www.mockobjects.com/2008/06/public-training-courses.html</link><author>noreply@blogger.com (Steve Freeman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-34908752.post-5676539118854047395</guid><pubDate>Fri, 30 May 2008 09:47:00 +0000</pubDate><atom:updated>2008-05-30T11:15:45.913+01:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>news</category><category domain='http://www.blogger.com/atom/ns#'>talk</category><title>Talk at London Geek Night.</title><description>&lt;p&gt;Nat and I gave a talk at the most recent &lt;a href="http://londongeeknights.wetpaint.com/page/Mocking+with+Java+Night"&gt;London Geek Night&lt;/a&gt;. It was an introduction to our approach to Test-Driven Development, incidentally making the point that some of the state- vs. interaction-based TDD wars are a bit specious; it's a matter of picking the right tool for the job. We had a good crowd and some useful questions. Afterwards, there was a Code Dojo in which Nat took part while I got stuck at the back talking to people. Thanks again to our hosts for an interesting evening.&lt;/p&gt;

&lt;p&gt;We've uploaded the &lt;a href="/files/talk-geeknight-2008.pdf"&gt;slides with notes&lt;/a&gt;. The format's a little odd because we used the toolchain we use for our &lt;a href="http://www.mockobjects.com/2008/05/learn-from-source.html"&gt;courses&lt;/a&gt;, but the material's all there.&lt;/p&gt;

&lt;p&gt;There are couple of other relevant links. Nils Haugen has a nice talk he did on &lt;a href="http://www4.java.no/presentations/javazone/2007/slides/5262.pdf"&gt;Improving Test Maintainability&lt;/a&gt;, which is about making sure the tests make sense. Our interest is more in the stage after that, which is about listening to &lt;a href="http://www.mockobjects.com/labels/listening%20to%20the%20tests.html"&gt;what the tests are telling you&lt;/a&gt; about the design of your code.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34908752-5676539118854047395?l=www.mockobjects.com%2Findex.html'/&gt;&lt;/div&gt;</description><link>http://www.mockobjects.com/2008/05/talk-at-london-geek-night.html</link><author>noreply@blogger.com (Steve Freeman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>4</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-34908752.post-6915536228811279767</guid><pubDate>Fri, 23 May 2008 16:37:00 +0000</pubDate><atom:updated>2008-06-05T15:42:47.951+01:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>news</category><category domain='http://www.blogger.com/atom/ns#'>training</category><category domain='http://www.blogger.com/atom/ns#'>junit4</category><category domain='http://www.blogger.com/atom/ns#'>jmock</category><title>Learn from the source!</title><description>&lt;p&gt;Nat, &lt;a href="http://www.cocking.co.uk/blog/"&gt;Romilly Cocking&lt;/a&gt;, and I are now open for business for training. We have a course on &lt;span style="font-weight:bold;"&gt;Test-Driven Development&lt;/span&gt; that reflects nearly a decade of experience writing tests first (that's 30 years in parallel). We also have significant experience in training, Romilly has a couple of decades on his own, and Nat and I have taught commercially and at two of the top CS departments in the country.&lt;/p&gt;

&lt;p&gt;The course teaches the practice of Test-Driven Development, based on a solid understanding of Object-Oriented design, and with a strong emphasis on making tests expressive and maintainable. We also make a point of exploring how unit tests can be used to &lt;span style="font-style:italic;"&gt;drive&lt;/span&gt; the design of the code, not just protect it.&lt;/p&gt;

&lt;p&gt;The content is modular, so we can adjust it to match the needs of the participants. The full-length course is three busy days, and we've taught versions that are a half-day and whole-day long.&lt;/p&gt;

&lt;p&gt;We teach the course using &lt;a href="http://sourceforge.net/projects/junit"&gt;jUnit4&lt;/a&gt;, &lt;a href="http://code.google.com/p/hamcrest/"&gt;Hamcrest&lt;/a&gt;, and (of course) &lt;a href="http://www.jmock.org"&gt;jMock2&lt;/a&gt;. Talk to us if you want something different.&lt;/p&gt;

&lt;p&gt;For more information, contact us at: &lt;span style="font-weight:bold;"&gt;training@mockobjects.com&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Here's what some attendees liked about the course:&lt;/p&gt;
&lt;blockquote&gt;&amp;ldquo;The practical exposure to a better way of testing&amp;rdquo;&lt;/blockquote&gt;
&lt;blockquote&gt;&amp;ldquo;Practical lab work, real-world concrete examples, Expert lecturers!&amp;rdquo;&lt;/blockquote&gt;
&lt;blockquote&gt;&amp;ldquo;Chance to make mistakes and learn. Exposure to new technology.&amp;rdquo;&lt;/blockquote&gt;
&lt;blockquote&gt;&amp;ldquo;A very good whole picture view of TDD and mocks&amp;rdquo;&lt;/blockquote&gt;
&lt;blockquote&gt;&amp;ldquo;Interaction and explanation of course materials particularly through the exercises.&amp;rdquo;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34908752-6915536228811279767?l=www.mockobjects.com%2Findex.html'/&gt;&lt;/div&gt;</description><link>http://www.mockobjects.com/2008/05/learn-from-source.html</link><author>noreply@blogger.com (Steve Freeman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>4</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-34908752.post-2597209967263939177</guid><pubDate>Sat, 08 Mar 2008 09:52:00 +0000</pubDate><atom:updated>2008-03-08T11:24:30.404Z</atom:updated><category domain='http://www.blogger.com/atom/ns#'>ide</category><category domain='http://www.blogger.com/atom/ns#'>design</category><category domain='http://www.blogger.com/atom/ns#'>testability</category><title>Another round in the testability debate</title><description>&lt;p&gt;This time a &lt;a href="http://blogs.msdn.com/ploeh/default.aspx"&gt;posting&lt;/a&gt; from Mark Seemann has raised a slew of comments.&lt;/p&gt; 
&lt;p&gt;One of them is a note from Colin Jack about the annoyance of producing interface/implementation pairs all the time. My first response is that that sounds to me a bit like a problem with style. Maybe it's just wordplay, but usually I don't &lt;span style="font-style:italic;"&gt;extract&lt;/span&gt; interfaces from classes, I &lt;span style="font-style:italic;"&gt;implement&lt;/span&gt; interfaces that I've already discovered in some previous test.&lt;/p&gt;

&lt;p&gt;My second response is to wonder how much this is a tools issue. I don't believe there's anything in the .Net world that yet matches the responsiveness of the usual Java IDE's. It makes a difference as to what's plausible. I remember the huge shift in perception when first VisualAge for Java and then JetBrains' Idea came out. In retrospect, I always spent more on time on rework than many people I worked with &lt;sup&gt;1&lt;/sup&gt; but it sure took a lot more time in emacs (and I was pretty good at it), even if I was working in a &lt;a href="http://modula3.org/"&gt;better language&lt;/a&gt;.
&lt;/p&gt;

&lt;hr/&gt;
&lt;p&gt;1) which is not to say who was right, I'm just wired that way...&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34908752-2597209967263939177?l=www.mockobjects.com%2Findex.html'/&gt;&lt;/div&gt;</description><link>http://www.mockobjects.com/2008/03/another-round-in-testability-debate.html</link><author>noreply@blogger.com (Steve Freeman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>5</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-34908752.post-2795194424094785701</guid><pubDate>Tue, 12 Feb 2008 10:03:00 +0000</pubDate><atom:updated>2008-02-12T10:05:11.787Z</atom:updated><category domain='http://www.blogger.com/atom/ns#'>news</category><title>New Tutorial at QCon</title><description>On Tuesday 11th March, at QCon London, &lt;a href="http://www.cocking.co.uk/blog/"&gt;Romilly Cocking &lt;/a&gt;and I will be running a new tutorial we're developing with &lt;a href="http://nat.truemesh.com"&gt;Nat Pryce&lt;/a&gt; on 

&lt;a href="http://qcon.infoq.com/london/presentation/TDD+with+MockObjects"&gt;Test-Driven Development with Mock Objects&lt;/a&gt;

following on from a successful first run at the last XpDay. 

Sign up soon!&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34908752-2795194424094785701?l=www.mockobjects.com%2Findex.html'/&gt;&lt;/div&gt;</description><link>http://www.mockobjects.com/2008/02/new-tutorial-at-qcon.html</link><author>noreply@blogger.com (Steve Freeman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-34908752.post-865473193129811678</guid><pubDate>Sun, 20 Jan 2008 11:57:00 +0000</pubDate><atom:updated>2008-01-20T13:26:11.613Z</atom:updated><category domain='http://www.blogger.com/atom/ns#'>design</category><category domain='http://www.blogger.com/atom/ns#'>testability</category><title>Just when you thought it was safe to go back in the water...</title><description>&lt;p&gt;Rising to the bait again (to keep the fishy metaphor going), there's &lt;a href="http://weblogs.asp.net/rosherove/archive/2008/01/18/dependency-injection-is-it-relevant-beyond-unit-testing.aspx"&gt;yet another discussion&lt;/a&gt; of how the ability to hack the runtime changes the world. At one level that's true, but not in this case.&lt;/p&gt;

&lt;p&gt;Dependency Injection is not a recent invention that a cabal of TDDers forced on the world, and it's absolutely not something that we came up with just so we could crowbar in our Mock Objects.&lt;/p&gt;

&lt;p&gt;The relevant design guideline, named the &lt;a href="http://en.wikipedia.org/wiki/Law_of_Demeter"&gt;Law of Demeter&lt;/a&gt; ("Strong Suggestion" isn't very catchy) was first described by Karl Lieberherr in &lt;span style="font-style:italic;"&gt;1987&lt;/span&gt;! The Mock Object pattern came from people applying their substantial O-O experience to TDD in Java, trying to figure out how best to avoid exposing implementation details in unit tests. One of the critical lessons from Demeter is that objects should have explicit dependencies. It helps to keep them focussed on their responsibilities and, as a result, easier to maintain&amp;mdash;and a good way to make dependencies explicit is to pass them in.&lt;/p&gt;

&lt;p&gt;Unfortunately, since then the world seems to have filled up with DI frameworks which cloud what should be a coding style discussion. This is not about having to configure every last corner of your application in XML, this is about how objects, or small clusters of them, get to talk to each other.&lt;/p&gt;

&lt;p&gt;Roy asks, "[...] do you need DI all over the place, or just in specific places where you know dependencies could be a problem?" Well no&amp;mdash;if you have enough foresight to know where those places are. I'm struggling at the moment to test against a framework where everything is helpfully packaged up nice and tight so I can't create an instance of one of its core objects. It's actually well written, but the authors just weren't good enough at prophecy to figure out my particular need. That's why I don't rely just on my intuition, I use the needs of my unit tests to help me figure out where the seams should be. To counter the &lt;a href="http://weblogs.asp.net/rosherove/archive/2008/01/17/is-typemock-too-powerful-will-it-kill-design-for-testability.aspx"&gt;FUD argument&lt;/a&gt;, I have absolutely no problem with saying that I don't want tools that do magic because &lt;span style="font-style:italic;"&gt;I&lt;/span&gt; need guidance with my code.&lt;/p&gt;

&lt;p&gt;As Roy (very politely) concludes, there isn't a high enough proportion of really good code in the world (some of it mine) that we should be in hurry to cut back on techniques such as DI. Just because something has been around for a while doesn't mean it's been superseded, especially in as conventional an environment as .Net.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34908752-865473193129811678?l=www.mockobjects.com%2Findex.html'/&gt;&lt;/div&gt;</description><link>http://www.mockobjects.com/2008/01/just-when-you-thought-it-was-safe-to-go.html</link><author>noreply@blogger.com (Steve Freeman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>9</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-34908752.post-8901297553364329389</guid><pubDate>Sun, 13 Jan 2008 09:59:00 +0000</pubDate><atom:updated>2008-01-13T10:21:56.373Z</atom:updated><category domain='http://www.blogger.com/atom/ns#'>design</category><category domain='http://www.blogger.com/atom/ns#'>listening to the tests</category><category domain='http://www.blogger.com/atom/ns#'>testability</category><title>Avoid mega unit tests</title><description>&lt;p&gt;We've just had a posting to the jMock user list that included the following:&lt;/p&gt;

&lt;blockquote&gt;I was involved in a project recently where JMock was used quite heavily. Looking back, here's what I found:

&lt;ol&gt;
&lt;li&gt;The unit tests where at times unreadable (no idea what they were doing).&lt;/li&gt;
&lt;li&gt;Some tests classes would reach 500 lines in addition to inheriting an
abstract class which also would have up to 500 lines.&lt;/li&gt;
&lt;li&gt;Refactoring would lead to massive changes in test code.&lt;/li&gt;
&lt;/ol&gt;&lt;/blockquote&gt;

&lt;p&gt;I've seen this failure mode on another project I've been helping with, so I think there might be a common pattern.&lt;/p&gt;

&lt;p&gt;I don't think any &lt;i&gt;unit&lt;/i&gt; test code should get that large, except for unusual circumstances. Unit tests are supposed to focus on at most a few classes and shouldn't need a large amount of set up.  What I saw on the other project was enormous amounts of preparation and positioning to get the objects into a state where the expected feature could be exercised. Of course it's hard to understand the point of a test when there's just so much code. If you see this pattern, then I'd suggest that the code (or at least the test code) needs breaking up a bit. On the other hand, &lt;i&gt;integration&lt;/i&gt; and &lt;i&gt;acceptance&lt;/i&gt; tests that happen to be written using a unit test framework might well be larger.&lt;/p&gt;

&lt;p&gt;One thing I need to explore is whether the naive use of interaction-testing is particularly susceptible to this failing, or whether it happens all the time and we're the only ones who get complained to. I am, however, convinced that the emphasis on mainly using Mocks to substitute external systems (some of which I perpetrated myself in the early days) is a deeply bad idea which pushes teams towards the sort of problem described here.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34908752-8901297553364329389?l=www.mockobjects.com%2Findex.html'/&gt;&lt;/div&gt;</description><link>http://www.mockobjects.com/2008/01/avoid-mega-unit-tests.html</link><author>noreply@blogger.com (Steve Freeman)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>17</thr:total></item></channel></rss>