<?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: Test Doubles: When To (Not) Use Them</title> <atom:link href="http://davybrion.com/blog/2008/08/test-doubles-when-to-not-use-them/feed/" rel="self" type="application/rss+xml" /><link>http://davybrion.com/blog/2008/08/test-doubles-when-to-not-use-them/</link> <description>inquisitive: adjective. given to inquiry, research, or asking questions; eager for knowledge; intellectually curious</description> <lastBuildDate>Wed, 08 Feb 2012 11:42:42 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: First Experiences With RSpec/BDD</title><link>http://davybrion.com/blog/2008/08/test-doubles-when-to-not-use-them/comment-page-1/#comment-101123</link> <dc:creator>First Experiences With RSpec/BDD</dc:creator> <pubDate>Sat, 03 Sep 2011 15:42:41 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=305#comment-101123</guid> <description>[...] doesn&#039;t mean i wouldn&#039;t mock anything in Ruby tests... it just means that i would try to follow my own rules on the subject as much as possible, whereas in the .NET world many of us (myself included) probably [...]</description> <content:encoded><![CDATA[<p>[...] doesn&#039;t mean i wouldn&#039;t mock anything in Ruby tests&#8230; it just means that i would try to follow my own rules on the subject as much as possible, whereas in the .NET world many of us (myself included) probably [...]</p> ]]></content:encoded> </item> <item><title>By: Dhananjay Goyani</title><link>http://davybrion.com/blog/2008/08/test-doubles-when-to-not-use-them/comment-page-1/#comment-42116</link> <dc:creator>Dhananjay Goyani</dc:creator> <pubDate>Wed, 16 Jun 2010 05:06:22 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=305#comment-42116</guid> <description>Yes, I agree. I much liked - replace external resource with a double. That way you simply making your test focused and independent.As per Mark&#039;s reasoning (pasted at bottom), I still think that by mocking he means to verify behavior/interaction on the 3rd party components. Unit testing somebody else&#039;s code is not one&#039;s responsibility and secondly writing a wrapper on top of each library for testability seems weird to me IMO.Well, I follow your recommendation just that I want to decipher Mark&#039;s suggestion.----------------------
&lt;i&gt;There are a couple of reasons why doing this isn&#039;t a great idea:1) We have no idea what the correct method calls are in the first place so we&#039;re just guessing based on looking through the Hibernate code and selecting the methods that we think make it work correctly.2) If the library code gets changed then our tests break even though functionally the code might still work
&lt;/i&gt;
----------------------</description> <content:encoded><![CDATA[<p>Yes, I agree. I much liked &#8211; replace external resource with a double. That way you simply making your test focused and independent.</p><p>As per Mark&#8217;s reasoning (pasted at bottom), I still think that by mocking he means to verify behavior/interaction on the 3rd party components. Unit testing somebody else&#8217;s code is not one&#8217;s responsibility and secondly writing a wrapper on top of each library for testability seems weird to me IMO.</p><p>Well, I follow your recommendation just that I want to decipher Mark&#8217;s suggestion.</p><p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br
/> <i>There are a couple of reasons why doing this isn&#8217;t a great idea:</p><p>1) We have no idea what the correct method calls are in the first place so we&#8217;re just guessing based on looking through the Hibernate code and selecting the methods that we think make it work correctly.</p><p>2) If the library code gets changed then our tests break even though functionally the code might still work<br
/> </i><br
/> &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p> ]]></content:encoded> </item> <item><title>By: Davy Brion</title><link>http://davybrion.com/blog/2008/08/test-doubles-when-to-not-use-them/comment-page-1/#comment-42070</link> <dc:creator>Davy Brion</dc:creator> <pubDate>Tue, 15 Jun 2010 17:26:44 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=305#comment-42070</guid> <description>@Dhananjayno, a test double can be a mock or a stub... it&#039;s just a term that means that the implementation of one of the dependencies will be replaced with something else.  Regardless of whether it&#039;s a mock or a stub.And i still recommend the same guidelines as i did originally in this post, regardless of the point Mark makes in his post</description> <content:encoded><![CDATA[<p>@Dhananjay</p><p>no, a test double can be a mock or a stub&#8230; it&#8217;s just a term that means that the implementation of one of the dependencies will be replaced with something else.  Regardless of whether it&#8217;s a mock or a stub.</p><p>And i still recommend the same guidelines as i did originally in this post, regardless of the point Mark makes in his post</p> ]]></content:encoded> </item> <item><title>By: Dhananjay Goyani</title><link>http://davybrion.com/blog/2008/08/test-doubles-when-to-not-use-them/comment-page-1/#comment-42037</link> <dc:creator>Dhananjay Goyani</dc:creator> <pubDate>Tue, 15 Jun 2010 06:41:50 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=305#comment-42037</guid> <description>While browsing for something, I come across this post somehow. Excellent one, as usual - Davy.&gt;&gt;&gt; If a component uses an external resource (a database, a file, a remote service, …) either directly or indirectly, then i always replace the component with a double when i’m testing code that is dependent on it.Now above statement go against &lt;a href=&quot;http://www.markhneedham.com/blog/2009/12/13/tdd-only-mock-types-you-own/&quot; title=&quot;TDD: Only mock types you own&quot; rel=&quot;nofollow&quot;&gt;Mark&#039;s&lt;/a&gt;.Test Double in your post seems to be PURE stub however by &#039;mocking&#039; Mark is referring to stub in &quot;verifying behavior/interaction&quot; context.Can you make it little bit more clear?</description> <content:encoded><![CDATA[<p>While browsing for something, I come across this post somehow. Excellent one, as usual &#8211; Davy.</p><p>&gt;&gt;&gt; If a component uses an external resource (a database, a file, a remote service, …) either directly or indirectly, then i always replace the component with a double when i’m testing code that is dependent on it.</p><p>Now above statement go against <a
href="http://www.markhneedham.com/blog/2009/12/13/tdd-only-mock-types-you-own/" title="TDD: Only mock types you own" rel="nofollow">Mark&#8217;s</a>.</p><p>Test Double in your post seems to be PURE stub however by &#8216;mocking&#8217; Mark is referring to stub in &#8220;verifying behavior/interaction&#8221; context.</p><p>Can you make it little bit more clear?</p> ]]></content:encoded> </item> <item><title>By: Nocturn vision &#187; Blog Archive &#187; Introduction to test-doubles</title><link>http://davybrion.com/blog/2008/08/test-doubles-when-to-not-use-them/comment-page-1/#comment-9987</link> <dc:creator>Nocturn vision &#187; Blog Archive &#187; Introduction to test-doubles</dc:creator> <pubDate>Mon, 16 Mar 2009 18:59:26 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=305#comment-9987</guid> <description>[...] doubles by Martin FowlerxUnit Test Patterns by Gerard Meszaros (also check out the website)Test Doubles: When (not) to use them by Davy [...]</description> <content:encoded><![CDATA[<p>[...] doubles by Martin FowlerxUnit Test Patterns by Gerard Meszaros (also check out the website)Test Doubles: When (not) to use them by Davy [...]</p> ]]></content:encoded> </item> <item><title>By: Reflective Perspective - Chris Alcock &#187; The Morning Brew #159</title><link>http://davybrion.com/blog/2008/08/test-doubles-when-to-not-use-them/comment-page-1/#comment-1159</link> <dc:creator>Reflective Perspective - Chris Alcock &#187; The Morning Brew #159</dc:creator> <pubDate>Fri, 15 Aug 2008 07:19:28 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=305#comment-1159</guid> <description>[...] Test Doubles: When To (Not) Use Them - Davy Brion gives some guidance for choosing when to use the real component and when to use a test double in its place when writing tests. [...]</description> <content:encoded><![CDATA[<p>[...] Test Doubles: When To (Not) Use Them &#8211; Davy Brion gives some guidance for choosing when to use the real component and when to use a test double in its place when writing tests. [...]</p> ]]></content:encoded> </item> <item><title>By: Dew Drop - August 14, 2008 &#124; Alvin Ashcraft's Morning Dew</title><link>http://davybrion.com/blog/2008/08/test-doubles-when-to-not-use-them/comment-page-1/#comment-1151</link> <dc:creator>Dew Drop - August 14, 2008 &#124; Alvin Ashcraft's Morning Dew</dc:creator> <pubDate>Thu, 14 Aug 2008 13:50:04 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=305#comment-1151</guid> <description>[...] Test Doubles: When to (Not) Use Them (Davy Brion) [...]</description> <content:encoded><![CDATA[<p>[...] Test Doubles: When to (Not) Use Them (Davy Brion) [...]</p> ]]></content:encoded> </item> <item><title>By: Davy Brion</title><link>http://davybrion.com/blog/2008/08/test-doubles-when-to-not-use-them/comment-page-1/#comment-1150</link> <dc:creator>Davy Brion</dc:creator> <pubDate>Thu, 14 Aug 2008 05:43:35 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=305#comment-1150</guid> <description>true, up to a point. We currently have 2 projects at work where practically all of the tests use the database.  One has about 11000 tests, and the tests take 20 minutes to run. Nobody runs the tests on their own machine, they always wait for the buildserver to run them. Apart from being horribly slow, the developers of that team actually do a great job of keeping that build &#039;green&#039; as much as possible. Still, i would much rather see them having a test suite that can be ran by anyone at any time without wasting time on it.The second project has about 7000 tests, which take about 10 minutes to run. The biggest problem with this project is not the time wasted running the tests, but the time wasted on writing the setup for each test because they have a horribly complicated data model. For every new test, they are wasting a lot of time just to be able to write tests. There&#039;s also a large maintenance cost involved... i&#039;ve heard some developers claim that they often spend 4 hours or more fixing/modifying tests that are related to a fix/modification in the code which only took them about an hour to do.  Those tests are also extremely fragile, up to the point where i&#039;m actually suprised if the project has a completely green build. It doesn&#039;t happen often. And it never lasts long.</description> <content:encoded><![CDATA[<p>true, up to a point. We currently have 2 projects at work where practically all of the tests use the database.  One has about 11000 tests, and the tests take 20 minutes to run. Nobody runs the tests on their own machine, they always wait for the buildserver to run them. Apart from being horribly slow, the developers of that team actually do a great job of keeping that build &#8216;green&#8217; as much as possible. Still, i would much rather see them having a test suite that can be ran by anyone at any time without wasting time on it.</p><p>The second project has about 7000 tests, which take about 10 minutes to run. The biggest problem with this project is not the time wasted running the tests, but the time wasted on writing the setup for each test because they have a horribly complicated data model. For every new test, they are wasting a lot of time just to be able to write tests. There&#8217;s also a large maintenance cost involved&#8230; i&#8217;ve heard some developers claim that they often spend 4 hours or more fixing/modifying tests that are related to a fix/modification in the code which only took them about an hour to do.  Those tests are also extremely fragile, up to the point where i&#8217;m actually suprised if the project has a completely green build. It doesn&#8217;t happen often. And it never lasts long.</p> ]]></content:encoded> </item> <item><title>By: anon</title><link>http://davybrion.com/blog/2008/08/test-doubles-when-to-not-use-them/comment-page-1/#comment-1149</link> <dc:creator>anon</dc:creator> <pubDate>Thu, 14 Aug 2008 04:34:22 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=305#comment-1149</guid> <description>The problem we found is that developers are too used to working closely with databases, so when we introduced unit tests, a lot more tests than was necessary had db dependancies.Of course this doesn&#039;t scale well, takes a lot more setup/teardown work and is generally a bad idea, but the hard part is convincing people that separation of concerns (and single responsibility principle) is often the root cause of this database dependency problem. One person I work with has adopted (db dependent quasi-unit) testing and loves it, so I don&#039;t want to discourage them. I&#039;d rather have slow tests than no tests at all.</description> <content:encoded><![CDATA[<p>The problem we found is that developers are too used to working closely with databases, so when we introduced unit tests, a lot more tests than was necessary had db dependancies.</p><p>Of course this doesn&#8217;t scale well, takes a lot more setup/teardown work and is generally a bad idea, but the hard part is convincing people that separation of concerns (and single responsibility principle) is often the root cause of this database dependency problem. One person I work with has adopted (db dependent quasi-unit) testing and loves it, so I don&#8217;t want to discourage them. I&#8217;d rather have slow tests than no tests at all.</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 2/13 queries in 0.007 seconds using disk: basic
Object Caching 450/451 objects using disk: basic
Content Delivery Network via Amazon Web Services: CloudFront: d18sni7re4ly7f.cloudfront.net

Served from: davybrion.com @ 2012-02-08 18:31:28 -->
