<?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: Putting mocks in their place</title>
	<atom:link href="http://lostechies.com/jimmybogard/2011/01/07/putting-mocks-in-their-place/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/jimmybogard/2011/01/07/putting-mocks-in-their-place/</link>
	<description>Strong opinions, weakly held</description>
	<lastBuildDate>Thu, 23 May 2013 23:40:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
	<item>
		<title>By: Vasilio Ruzanni</title>
		<link>http://lostechies.com/jimmybogard/2011/01/07/putting-mocks-in-their-place/#comment-3527</link>
		<dc:creator>Vasilio Ruzanni</dc:creator>
		<pubDate>Sun, 26 Jun 2011 00:08:00 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2011/01/06/putting-mocks-in-their-place.aspx#comment-3527</guid>
		<description>How about specific implementation when our Command invoker (CommandBus) is returning at least Ack/Nak kind of result (on CommandBus.Broadcast(command) call) so we do always know that Command is being processed?
Probably, we don&#039;t need an AssertWasCalled at all?</description>
		<content:encoded><![CDATA[<p>How about specific implementation when our Command invoker (CommandBus) is returning at least Ack/Nak kind of result (on CommandBus.Broadcast(command) call) so we do always know that Command is being processed?<br />
Probably, we don&#8217;t need an AssertWasCalled at all?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Uttam Kini</title>
		<link>http://lostechies.com/jimmybogard/2011/01/07/putting-mocks-in-their-place/#comment-2771</link>
		<dc:creator>Uttam Kini</dc:creator>
		<pubDate>Fri, 14 Jan 2011 23:53:15 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2011/01/06/putting-mocks-in-their-place.aspx#comment-2771</guid>
		<description>I agree that mocks are misused. But I think if used correctly, they can breed good OO and flexible code. 
Even for code without external dependencies, if I have a sufficiently complex piece of business logic, then without mocks my unit test becomes a huge suite of integration tests. 
Having said that, if I see a unit tests with a lot mock assertWasCalleds then it is a code smell for me, which indicates the class under test is probably doing too much.</description>
		<content:encoded><![CDATA[<p>I agree that mocks are misused. But I think if used correctly, they can breed good OO and flexible code.<br />
Even for code without external dependencies, if I have a sufficiently complex piece of business logic, then without mocks my unit test becomes a huge suite of integration tests.<br />
Having said that, if I see a unit tests with a lot mock assertWasCalleds then it is a code smell for me, which indicates the class under test is probably doing too much.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: - Martin </title>
		<link>http://lostechies.com/jimmybogard/2011/01/07/putting-mocks-in-their-place/#comment-2770</link>
		<dc:creator>- Martin </dc:creator>
		<pubDate>Thu, 13 Jan 2011 00:11:46 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2011/01/06/putting-mocks-in-their-place.aspx#comment-2770</guid>
		<description>I can see wher eyoru coming form but i think you need balance in your assertions about mocking especially in a BDD context i would offer this post as a balancing perspective if i may. 

http://martinsharp.wordpress.com/2011/01/09/interface-first-development-and-mocking-overview/

if you would like to discuss please email me on rebeccamartin@me.com </description>
		<content:encoded><![CDATA[<p>I can see wher eyoru coming form but i think you need balance in your assertions about mocking especially in a BDD context i would offer this post as a balancing perspective if i may. </p>
<p><a href="http://martinsharp.wordpress.com/2011/01/09/interface-first-development-and-mocking-overview/" rel="nofollow">http://martinsharp.wordpress.com/2011/01/09/interface-first-development-and-mocking-overview/</a></p>
<p>if you would like to discuss please email me on <a href="mailto:rebeccamartin@me.com">rebeccamartin@me.com</a> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: derekgreer</title>
		<link>http://lostechies.com/jimmybogard/2011/01/07/putting-mocks-in-their-place/#comment-2769</link>
		<dc:creator>derekgreer</dc:creator>
		<pubDate>Sat, 08 Jan 2011 13:49:50 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2011/01/06/putting-mocks-in-their-place.aspx#comment-2769</guid>
		<description>@ntcoding

It isn&#039;t that programmer tests never use test doubles, it&#039;s just that there isn&#039;t an emphasis on isolation and therefore real collaborators are used when possible. Collaborators which encapsulate access across a process boundary (such as a repository) would generally be stubbed within a programmer test as well.  Perhaps a better example for contrast might be how a class with a calculator dependency might be tested with a unit test verses a programmer test. </description>
		<content:encoded><![CDATA[<p>@ntcoding</p>
<p>It isn&#8217;t that programmer tests never use test doubles, it&#8217;s just that there isn&#8217;t an emphasis on isolation and therefore real collaborators are used when possible. Collaborators which encapsulate access across a process boundary (such as a repository) would generally be stubbed within a programmer test as well.  Perhaps a better example for contrast might be how a class with a calculator dependency might be tested with a unit test verses a programmer test. </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ntcoding</title>
		<link>http://lostechies.com/jimmybogard/2011/01/07/putting-mocks-in-their-place/#comment-2768</link>
		<dc:creator>ntcoding</dc:creator>
		<pubDate>Sat, 08 Jan 2011 11:45:20 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2011/01/06/putting-mocks-in-their-place.aspx#comment-2768</guid>
		<description>@derekgreer

That comment you make helps to put things into perspective for me. If I&#039;m right then your essentially saying you can&#039;t have unit tests (that isolate the smallest unit of code) without mocks.

Going back to my comment above, if you mock the repository then you do have a fine-grained unit test. If you don&#039;t mock the repository you have the &quot;XP Programmer Tests&quot; which can cause controller tests to fail if the repository tests fail.

I think we are all looking forward to the next installment. You have built a lot of expectancy now Mr Bogard.

</description>
		<content:encoded><![CDATA[<p>@derekgreer</p>
<p>That comment you make helps to put things into perspective for me. If I&#8217;m right then your essentially saying you can&#8217;t have unit tests (that isolate the smallest unit of code) without mocks.</p>
<p>Going back to my comment above, if you mock the repository then you do have a fine-grained unit test. If you don&#8217;t mock the repository you have the &#8220;XP Programmer Tests&#8221; which can cause controller tests to fail if the repository tests fail.</p>
<p>I think we are all looking forward to the next installment. You have built a lot of expectancy now Mr Bogard.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: derekgreer</title>
		<link>http://lostechies.com/jimmybogard/2011/01/07/putting-mocks-in-their-place/#comment-2767</link>
		<dc:creator>derekgreer</dc:creator>
		<pubDate>Sat, 08 Jan 2011 07:02:05 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2011/01/06/putting-mocks-in-their-place.aspx#comment-2767</guid>
		<description>It sounds like you&#039;re advocating the use of XP &quot;Programmer Tests&quot; over isolation tests (what most call unit tests).  I can see pros and cons with both approaches. Programmer tests are less brittle because they don&#039;t make as much use of test doubles, but they also don&#039;t provide precise feedback about why a test failed (a single regression can result in many tests failing) or force decoupling through isolation. Isolation tests tend to force the designer to program to interfaces, but can be less resilient to change as compared to broader-brush tests.

I currently favor higher level acceptance tests which drive the creation of lower lever isolation tests because I like the specific feedback and the discipline it seems to provide (especially for teams new to TDD/BDD), but I&#039;m looking forward to reading the arguments you present in your follow-up post. </description>
		<content:encoded><![CDATA[<p>It sounds like you&#8217;re advocating the use of XP &#8220;Programmer Tests&#8221; over isolation tests (what most call unit tests).  I can see pros and cons with both approaches. Programmer tests are less brittle because they don&#8217;t make as much use of test doubles, but they also don&#8217;t provide precise feedback about why a test failed (a single regression can result in many tests failing) or force decoupling through isolation. Isolation tests tend to force the designer to program to interfaces, but can be less resilient to change as compared to broader-brush tests.</p>
<p>I currently favor higher level acceptance tests which drive the creation of lower lever isolation tests because I like the specific feedback and the discipline it seems to provide (especially for teams new to TDD/BDD), but I&#8217;m looking forward to reading the arguments you present in your follow-up post. </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh</title>
		<link>http://lostechies.com/jimmybogard/2011/01/07/putting-mocks-in-their-place/#comment-2766</link>
		<dc:creator>Josh</dc:creator>
		<pubDate>Fri, 07 Jan 2011 22:34:07 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2011/01/06/putting-mocks-in-their-place.aspx#comment-2766</guid>
		<description>External dependencies should not be mocked. Any code you do not own or have control over should not be mocked. Where such code is used, integration tests should be used. This is the only way to ensure the uncontrollable code is in fact doing what you expect, and that you code is interacting correctly with it. And you won&#039;t know this if you mock it out. 

If you need to separate out this uncontrollable code, you need to use an adapter layer. Integration test the adapter and uncontrollable code by mocking your calling code. You can now unit test your calling code by mocking the adapter.

This info was from GOOS. I really recommend this book.</description>
		<content:encoded><![CDATA[<p>External dependencies should not be mocked. Any code you do not own or have control over should not be mocked. Where such code is used, integration tests should be used. This is the only way to ensure the uncontrollable code is in fact doing what you expect, and that you code is interacting correctly with it. And you won&#8217;t know this if you mock it out. </p>
<p>If you need to separate out this uncontrollable code, you need to use an adapter layer. Integration test the adapter and uncontrollable code by mocking your calling code. You can now unit test your calling code by mocking the adapter.</p>
<p>This info was from GOOS. I really recommend this book.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: isaiah</title>
		<link>http://lostechies.com/jimmybogard/2011/01/07/putting-mocks-in-their-place/#comment-2765</link>
		<dc:creator>isaiah</dc:creator>
		<pubDate>Fri, 07 Jan 2011 22:13:28 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2011/01/06/putting-mocks-in-their-place.aspx#comment-2765</guid>
		<description>Hi Jimmy
&quot;Tests coupled to the implementation of the class under test are a barrier to refactoring&quot; if that is the case, the tests are hinting there is a issue with the design, as Rob suggested the GOOS book shows there is another school of thought where mocks are used an aid in designing OO code. one of the key things i got from GOOS book and chatting with steve and nat was distinguishing between internals and peer objects. </description>
		<content:encoded><![CDATA[<p>Hi Jimmy<br />
&#8220;Tests coupled to the implementation of the class under test are a barrier to refactoring&#8221; if that is the case, the tests are hinting there is a issue with the design, as Rob suggested the GOOS book shows there is another school of thought where mocks are used an aid in designing OO code. one of the key things i got from GOOS book and chatting with steve and nat was distinguishing between internals and peer objects. </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ntcoding</title>
		<link>http://lostechies.com/jimmybogard/2011/01/07/putting-mocks-in-their-place/#comment-2764</link>
		<dc:creator>ntcoding</dc:creator>
		<pubDate>Fri, 07 Jan 2011 20:04:08 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2011/01/06/putting-mocks-in-their-place.aspx#comment-2764</guid>
		<description>Please could you show how you would do a typical &quot;create&quot; scenario in say a web app. Let&#039;s say you are creating a &quot;fish&quot; object and saving it to the repository.

Would you mock the repository and assert methods were called? Would you mock only the &quot;data context&quot; for the repository?

Interesting blog post on a topic I have been debating (not arguing about :) ) with a colleague the last few days.

If you can&#039;t give me an example, then I can only look forward to the next episode.

Thanks</description>
		<content:encoded><![CDATA[<p>Please could you show how you would do a typical &#8220;create&#8221; scenario in say a web app. Let&#8217;s say you are creating a &#8220;fish&#8221; object and saving it to the repository.</p>
<p>Would you mock the repository and assert methods were called? Would you mock only the &#8220;data context&#8221; for the repository?</p>
<p>Interesting blog post on a topic I have been debating (not arguing about <img src='http://lostechies.com/jimmybogard/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ) with a colleague the last few days.</p>
<p>If you can&#8217;t give me an example, then I can only look forward to the next episode.</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Sonmez</title>
		<link>http://lostechies.com/jimmybogard/2011/01/07/putting-mocks-in-their-place/#comment-2763</link>
		<dc:creator>John Sonmez</dc:creator>
		<pubDate>Fri, 07 Jan 2011 14:27:28 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2011/01/06/putting-mocks-in-their-place.aspx#comment-2763</guid>
		<description>Keep banging that drum, you are headed the right direction I believe.  We overuse mocking and complicate unit tests, mocking only external dependencies seems like the right approach to me.</description>
		<content:encoded><![CDATA[<p>Keep banging that drum, you are headed the right direction I believe.  We overuse mocking and complicate unit tests, mocking only external dependencies seems like the right approach to me.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
