<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: TDD: Hand written stubs vs Framework generated stubs</title>
	<atom:link href="http://www.markhneedham.com/blog/2010/01/15/tdd-hand-written-stubs-vs-framework-generated-stubs/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.markhneedham.com/blog/2010/01/15/tdd-hand-written-stubs-vs-framework-generated-stubs/</link>
	<description>Thoughts on Software Development</description>
	<lastBuildDate>Sat, 11 Feb 2012 23:17:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: miluch</title>
		<link>http://www.markhneedham.com/blog/2010/01/15/tdd-hand-written-stubs-vs-framework-generated-stubs/comment-page-1/#comment-86487</link>
		<dc:creator>miluch</dc:creator>
		<pubDate>Thu, 20 Jan 2011 18:38:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=2036#comment-86487</guid>
		<description>Provided &quot;We tried to keep on using the same stub instance of the dependency&quot; you ended up using 2 references: hand rolled stub and framework mock. 
I always try to make my test method self descriptive and try to avoid using setup methods. Following this, if i find that my test method become bloated with setup code i try to refactor it into seprate builder method/classes</description>
		<content:encoded><![CDATA[<p>Provided &#8220;We tried to keep on using the same stub instance of the dependency&#8221; you ended up using 2 references: hand rolled stub and framework mock.<br />
I always try to make my test method self descriptive and try to avoid using setup methods. Following this, if i find that my test method become bloated with setup code i try to refactor it into seprate builder method/classes</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TDD: Simplifying a test with a hand rolled stub at Mark Needham</title>
		<link>http://www.markhneedham.com/blog/2010/01/15/tdd-hand-written-stubs-vs-framework-generated-stubs/comment-page-1/#comment-30947</link>
		<dc:creator>TDD: Simplifying a test with a hand rolled stub at Mark Needham</dc:creator>
		<pubDate>Mon, 25 Jan 2010 21:24:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=2036#comment-30947</guid>
		<description>[...] wrote a couple of weeks ago about my thoughts on hand written stubs vs framework generated stubs and I noticed an interesting situation where it helped me out while trying to simplify some test [...]</description>
		<content:encoded><![CDATA[<p>[...] wrote a couple of weeks ago about my thoughts on hand written stubs vs framework generated stubs and I noticed an interesting situation where it helped me out while trying to simplify some test [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Sorensen</title>
		<link>http://www.markhneedham.com/blog/2010/01/15/tdd-hand-written-stubs-vs-framework-generated-stubs/comment-page-1/#comment-30755</link>
		<dc:creator>Bill Sorensen</dc:creator>
		<pubDate>Fri, 22 Jan 2010 19:41:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=2036#comment-30755</guid>
		<description>You could skip the Setup and fields and have a method that returns a controller (or a dependency, then create the controller in the test methods). Adjust as needed for your cases and add new methods as needed. Basically refactor your unit tests to remove duplication.

private Controller GetController(int dependencyResult)
{
  ITheDependency theDependency = MockRepository.GenerateStub();
		theDependency.Stub(t =&gt; t.SomeMethod()).Return(dependencyResult);

  return new Controller(theDependency);
}</description>
		<content:encoded><![CDATA[<p>You could skip the Setup and fields and have a method that returns a controller (or a dependency, then create the controller in the test methods). Adjust as needed for your cases and add new methods as needed. Basically refactor your unit tests to remove duplication.</p>
<p>private Controller GetController(int dependencyResult)<br />
{<br />
  ITheDependency theDependency = MockRepository.GenerateStub();<br />
		theDependency.Stub(t =&gt; t.SomeMethod()).Return(dependencyResult);</p>
<p>  return new Controller(theDependency);<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Giorgio Sironi</title>
		<link>http://www.markhneedham.com/blog/2010/01/15/tdd-hand-written-stubs-vs-framework-generated-stubs/comment-page-1/#comment-30549</link>
		<dc:creator>Giorgio Sironi</dc:creator>
		<pubDate>Tue, 19 Jan 2010 22:44:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=2036#comment-30549</guid>
		<description>I think using generated Test Doubles is a symptom that abstractions are efficient, as their method&#039;s behavior is forced to be simple. That said, often hand written stubs are more expressive.</description>
		<content:encoded><![CDATA[<p>I think using generated Test Doubles is a symptom that abstractions are efficient, as their method&#8217;s behavior is forced to be simple. That said, often hand written stubs are more expressive.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Helltime for January 18 &#171; I Built His Cage</title>
		<link>http://www.markhneedham.com/blog/2010/01/15/tdd-hand-written-stubs-vs-framework-generated-stubs/comment-page-1/#comment-30511</link>
		<dc:creator>Helltime for January 18 &#171; I Built His Cage</dc:creator>
		<pubDate>Tue, 19 Jan 2010 04:03:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=2036#comment-30511</guid>
		<description>[...] Mark Needham raps about framework-generated versus hand-written test stubs. The few times I used a tool to auto-generate anything about my unit tests was with Jtest, and the [...]</description>
		<content:encoded><![CDATA[<p>[...] Mark Needham raps about framework-generated versus hand-written test stubs. The few times I used a tool to auto-generate anything about my unit tests was with Jtest, and the [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tweets that mention TDD: Hand written stubs vs Framework generated stubs at Mark Needham -- Topsy.com</title>
		<link>http://www.markhneedham.com/blog/2010/01/15/tdd-hand-written-stubs-vs-framework-generated-stubs/comment-page-1/#comment-30362</link>
		<dc:creator>Tweets that mention TDD: Hand written stubs vs Framework generated stubs at Mark Needham -- Topsy.com</dc:creator>
		<pubDate>Sat, 16 Jan 2010 07:26:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=2036#comment-30362</guid>
		<description>[...] This post was mentioned on Twitter by Mark Needham and planettw, Craig Taylor. Craig Taylor said: RT @markhneedham: handwritten vs framework generated stubs - some thoughts - http://bit.ly/4SxK3C [...]</description>
		<content:encoded><![CDATA[<p>[...] This post was mentioned on Twitter by Mark Needham and planettw, Craig Taylor. Craig Taylor said: RT @markhneedham: handwritten vs framework generated stubs &#8211; some thoughts &#8211; <a href="http://bit.ly/4SxK3C" rel="nofollow">http://bit.ly/4SxK3C</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Ron</title>
		<link>http://www.markhneedham.com/blog/2010/01/15/tdd-hand-written-stubs-vs-framework-generated-stubs/comment-page-1/#comment-30339</link>
		<dc:creator>David Ron</dc:creator>
		<pubDate>Sat, 16 Jan 2010 00:38:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=2036#comment-30339</guid>
		<description>I&#039;m not familiar with Mockito, but I use jMock quite frequently.  I often find myself writing:

@Test
public void testSomething(){
   expectSomethingWillHappen()
   service(findFromList(someList));
}

@Test
public void testSomethingElse(){
   expectSomethingWillHappen()
   service(findFromList(differentList));
}

private void expectSomethingWillHappen(){
   IrrelevantObject dummyObject = new IrrelevantObjectBuilder.build();
   context.checking(new Expectations(){{
      one(dao).findobject(with(any(List.class)));
      will(returnValue(dummyObject));
   }});  
}


This pattern works really really well, and is a lot more simple than hand-created mocks.</description>
		<content:encoded><![CDATA[<p>I&#8217;m not familiar with Mockito, but I use jMock quite frequently.  I often find myself writing:</p>
<p>@Test<br />
public void testSomething(){<br />
   expectSomethingWillHappen()<br />
   service(findFromList(someList));<br />
}</p>
<p>@Test<br />
public void testSomethingElse(){<br />
   expectSomethingWillHappen()<br />
   service(findFromList(differentList));<br />
}</p>
<p>private void expectSomethingWillHappen(){<br />
   IrrelevantObject dummyObject = new IrrelevantObjectBuilder.build();<br />
   context.checking(new Expectations(){{<br />
      one(dao).findobject(with(any(List.class)));<br />
      will(returnValue(dummyObject));<br />
   }});<br />
}</p>
<p>This pattern works really really well, and is a lot more simple than hand-created mocks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TDD: Thoughts on using a clock in tests at Mark Needham</title>
		<link>http://www.markhneedham.com/blog/2010/01/15/tdd-hand-written-stubs-vs-framework-generated-stubs/comment-page-1/#comment-30334</link>
		<dc:creator>TDD: Thoughts on using a clock in tests at Mark Needham</dc:creator>
		<pubDate>Fri, 15 Jan 2010 22:01:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=2036#comment-30334</guid>
		<description>[...] wrote previously about my thoughts of where to use each of the two approaches and one example of where hand written stubs seems to make sense is the [...]</description>
		<content:encoded><![CDATA[<p>[...] wrote previously about my thoughts of where to use each of the two approaches and one example of where hand written stubs seems to make sense is the [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

