<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-3861821447803614936.post5446168495701175212..comments</id><updated>2008-12-18T05:15:04.983-05:00</updated><title type='text'>Comments on Brian Cardarella's Blog: A case against Mocking and Stubbing</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://cardarella.blogspot.com/feeds/5446168495701175212/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3861821447803614936/5446168495701175212/comments/default'/><link rel='alternate' type='text/html' href='http://cardarella.blogspot.com/2008/12/case-against-mocking-and-stubbing.html'/><author><name>Brian Cardarella</name><uri>http://www.blogger.com/profile/13424980920465044626</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>8</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3861821447803614936.post-278269686528387262</id><published>2008-12-18T05:15:00.000-05:00</published><updated>2008-12-18T05:15:00.000-05:00</updated><title type='text'>Put your test-DB on a ramdisk or on a SSD and you'...</title><content type='html'>Put your test-DB on a ramdisk or on a SSD and you're halfway there.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3861821447803614936/5446168495701175212/comments/default/278269686528387262'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3861821447803614936/5446168495701175212/comments/default/278269686528387262'/><link rel='alternate' type='text/html' href='http://cardarella.blogspot.com/2008/12/case-against-mocking-and-stubbing.html?showComment=1229595300000#c278269686528387262' title=''/><author><name>jonelf</name><uri>http://www.blogger.com/profile/18088865137364783994</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://cardarella.blogspot.com/2008/12/case-against-mocking-and-stubbing.html' ref='tag:blogger.com,1999:blog-3861821447803614936.post-5446168495701175212' source='http://www.blogger.com/feeds/3861821447803614936/posts/default/5446168495701175212' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3861821447803614936.post-4532136424320019847</id><published>2008-12-11T19:25:00.000-05:00</published><updated>2008-12-11T19:25:00.000-05:00</updated><title type='text'>I think the crux of your argument is the assertion...</title><content type='html'>I think the crux of your argument is the assertion that "functional tests should rely upon the models being written properly." I don't see the support for that assertion.&lt;BR/&gt;&lt;BR/&gt;I also think that you're not accounting for integration tests, which will indeed fail if the model is not correct.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3861821447803614936/5446168495701175212/comments/default/4532136424320019847'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3861821447803614936/5446168495701175212/comments/default/4532136424320019847'/><link rel='alternate' type='text/html' href='http://cardarella.blogspot.com/2008/12/case-against-mocking-and-stubbing.html?showComment=1229041500000#c4532136424320019847' title=''/><author><name>Mark Wilden</name><uri>http://www.blogger.com/profile/07153901140004937121</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://cardarella.blogspot.com/2008/12/case-against-mocking-and-stubbing.html' ref='tag:blogger.com,1999:blog-3861821447803614936.post-5446168495701175212' source='http://www.blogger.com/feeds/3861821447803614936/posts/default/5446168495701175212' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3861821447803614936.post-6373788125418975084</id><published>2008-12-11T16:17:00.000-05:00</published><updated>2008-12-11T16:17:00.000-05:00</updated><title type='text'>"What if I change something on my model down the l...</title><content type='html'>&amp;quot;What if I change something on my model down the line, my unit test will fail, I fix that. But my functional tests still pass because I m&amp;amp;sed that functionality.&amp;quot;&lt;BR/&gt;&lt;BR/&gt;A technique that can help alleviate that problem is to use a stub/mock that will check the method you are stubbing/mocking actually exists with the correct arity on your model. Brian Takita&amp;#39;s rr framework supports this technique by prepending your stub/mock with strong. This provides the benefit of not being concerned if the implementation of model#whatever is correct, while also providing you with errors if model#whatever is removed or it&amp;#39;s signature changes.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3861821447803614936/5446168495701175212/comments/default/6373788125418975084'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3861821447803614936/5446168495701175212/comments/default/6373788125418975084'/><link rel='alternate' type='text/html' href='http://cardarella.blogspot.com/2008/12/case-against-mocking-and-stubbing.html?showComment=1229030220000#c6373788125418975084' title=''/><author><name>Michael</name><uri>http://www.blogger.com/profile/01511493588608164271</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://cardarella.blogspot.com/2008/12/case-against-mocking-and-stubbing.html' ref='tag:blogger.com,1999:blog-3861821447803614936.post-5446168495701175212' source='http://www.blogger.com/feeds/3861821447803614936/posts/default/5446168495701175212' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3861821447803614936.post-4671949390539743237</id><published>2008-12-11T15:05:00.000-05:00</published><updated>2008-12-11T15:05:00.000-05:00</updated><title type='text'>Thanks for all of the responses. This seems to hav...</title><content type='html'>Thanks for all of the responses. This seems to have really gotten under the skin of some Rspec people. Not my intention but still interesting. I still maintain my opinion that within an integrated testing approach that mocking/stubbing is going to cause major issues. One valid reason to use mocking/stubbing in this context would be when accessing resources outside of your project. (Geocoded data for example)&lt;BR/&gt;&lt;BR/&gt;I guess I should have made the database stuff a separate post because in all honesty I am more interested in that.&lt;BR/&gt;&lt;BR/&gt;topfunky: thanks for the update on using SQLite for an in-memory database. True, no code is faster than no code. But, as I stated RAM is faster than disk IO. I wonder if MySQL could be adapted to write to memory instead of disk. SQLite is slow in general, but is a good place to start for an app considering how easy it is to setup.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3861821447803614936/5446168495701175212/comments/default/4671949390539743237'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3861821447803614936/5446168495701175212/comments/default/4671949390539743237'/><link rel='alternate' type='text/html' href='http://cardarella.blogspot.com/2008/12/case-against-mocking-and-stubbing.html?showComment=1229025900000#c4671949390539743237' title=''/><author><name>Brian Cardarella</name><uri>http://www.blogger.com/profile/13424980920465044626</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11730442056074949069'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://cardarella.blogspot.com/2008/12/case-against-mocking-and-stubbing.html' ref='tag:blogger.com,1999:blog-3861821447803614936.post-5446168495701175212' source='http://www.blogger.com/feeds/3861821447803614936/posts/default/5446168495701175212' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3861821447803614936.post-8537816437395739084</id><published>2008-12-11T13:38:00.000-05:00</published><updated>2008-12-11T13:38:00.000-05:00</updated><title type='text'>Take off your rails colored glasses...There are va...</title><content type='html'>Take off your rails colored glasses...&lt;BR/&gt;&lt;BR/&gt;There are valid critiques of mocking, but you aren't really making those.  &lt;BR/&gt;&lt;BR/&gt;Your basic argument is that you can't test integration of components when you are just playing make believe.&lt;BR/&gt;&lt;BR/&gt;I totally agree, but that doesn't mean mocking isn't a great tool to have in the proper context.&lt;BR/&gt;&lt;BR/&gt;Functional tests are not one of those.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3861821447803614936/5446168495701175212/comments/default/8537816437395739084'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3861821447803614936/5446168495701175212/comments/default/8537816437395739084'/><link rel='alternate' type='text/html' href='http://cardarella.blogspot.com/2008/12/case-against-mocking-and-stubbing.html?showComment=1229020680000#c8537816437395739084' title=''/><author><name>littleidea</name><uri>http://www.blogger.com/profile/14856988138984400074</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://cardarella.blogspot.com/2008/12/case-against-mocking-and-stubbing.html' ref='tag:blogger.com,1999:blog-3861821447803614936.post-5446168495701175212' source='http://www.blogger.com/feeds/3861821447803614936/posts/default/5446168495701175212' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3861821447803614936.post-2425455690266507246</id><published>2008-12-11T12:09:00.000-05:00</published><updated>2008-12-11T12:09:00.000-05:00</updated><title type='text'>I started to leave a comment and found I had too m...</title><content type='html'>I started to leave a comment and found I had too much to say to respond properly here, so I posted my response on my blog. Feel free to comment here or there if you're interested in a dialog about this.&lt;BR/&gt;&lt;BR/&gt;The short version is that it makes sense that mocking won't work for you because it is an isolation technique and your approach favors integration.&lt;BR/&gt;&lt;BR/&gt;The long version is at http://blog.davidchelimsky.net/2008/12/11/a-case-against-a-case-against-mocking-and-stubbing.&lt;BR/&gt;&lt;BR/&gt;Cheers,&lt;BR/&gt;David</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3861821447803614936/5446168495701175212/comments/default/2425455690266507246'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3861821447803614936/5446168495701175212/comments/default/2425455690266507246'/><link rel='alternate' type='text/html' href='http://cardarella.blogspot.com/2008/12/case-against-mocking-and-stubbing.html?showComment=1229015340000#c2425455690266507246' title=''/><author><name>David Chelimsky</name><uri>http://www.blogger.com/profile/07397532906900221931</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://cardarella.blogspot.com/2008/12/case-against-mocking-and-stubbing.html' ref='tag:blogger.com,1999:blog-3861821447803614936.post-5446168495701175212' source='http://www.blogger.com/feeds/3861821447803614936/posts/default/5446168495701175212' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3861821447803614936.post-1950459658949450714</id><published>2008-12-11T11:43:00.000-05:00</published><updated>2008-12-11T11:43:00.000-05:00</updated><title type='text'>I've used SQLite memory databases for many apps an...</title><content type='html'>I've used SQLite memory databases for many apps and the speed was on par with using MySQL through a native driver.&lt;BR/&gt;&lt;BR/&gt;As the Merb guys say, "No code is faster than no code."</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3861821447803614936/5446168495701175212/comments/default/1950459658949450714'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3861821447803614936/5446168495701175212/comments/default/1950459658949450714'/><link rel='alternate' type='text/html' href='http://cardarella.blogspot.com/2008/12/case-against-mocking-and-stubbing.html?showComment=1229013780000#c1950459658949450714' title=''/><author><name>topfunky</name><uri>http://topfunky.com/</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://cardarella.blogspot.com/2008/12/case-against-mocking-and-stubbing.html' ref='tag:blogger.com,1999:blog-3861821447803614936.post-5446168495701175212' source='http://www.blogger.com/feeds/3861821447803614936/posts/default/5446168495701175212' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3861821447803614936.post-1607757907544377074</id><published>2008-12-10T18:57:00.000-05:00</published><updated>2008-12-10T18:57:00.000-05:00</updated><title type='text'>Here is a project that is attempting just what you...</title><content type='html'>Here is a project that is attempting just what you suggest using TreeTop as the SQL parser:&lt;BR/&gt;http://github.com/smtlaissezfaire/guillotine/&lt;BR/&gt;&lt;BR/&gt;re: your argument&lt;BR/&gt;All points are valid but you seem to leave off the design benefit of mocking which is the primary reason to use them.  Also, if you have stories (Cucumber features) driving your entire process like you say those will catch any breaks in between the layers.  That said both approaches are valid with pros and cons to each.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3861821447803614936/5446168495701175212/comments/default/1607757907544377074'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3861821447803614936/5446168495701175212/comments/default/1607757907544377074'/><link rel='alternate' type='text/html' href='http://cardarella.blogspot.com/2008/12/case-against-mocking-and-stubbing.html?showComment=1228953420000#c1607757907544377074' title=''/><author><name>Ben Mabey</name><uri>http://www.blogger.com/profile/08152995778702798400</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://cardarella.blogspot.com/2008/12/case-against-mocking-and-stubbing.html' ref='tag:blogger.com,1999:blog-3861821447803614936.post-5446168495701175212' source='http://www.blogger.com/feeds/3861821447803614936/posts/default/5446168495701175212' type='text/html'/></entry></feed>