<?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-8696186.post1478186483478607934..comments</id><updated>2011-11-22T12:35:00.317-04:00</updated><category term='code style'/><category term='python swig c threads'/><category term='visual studio assemblies 2008 manifest debug mfc c++ runtime'/><category term='programming'/><title type='text'>Comments on SandyWalsh.com: Effective Units Tests and Integration Tests</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.sandywalsh.com/feeds/1478186483478607934/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8696186/1478186483478607934/comments/default'/><link rel='alternate' type='text/html' href='http://www.sandywalsh.com/2011/06/effective-units-tests-and-integration.html'/><author><name>@TheSandyWalsh</name><uri>http://www.blogger.com/profile/17478332939768000715</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_Al595rN4OWo/S5o-MXFWibI/AAAAAAAAAFk/TKOxZTZ7w4A/S220/me.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>3</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8696186.post-974745948030930482</id><published>2011-11-22T12:08:44.574-04:00</published><updated>2011-11-22T12:08:44.574-04:00</updated><title type='text'>Good post, Sandy. I disagree on a couple of points...</title><content type='html'>Good post, Sandy. I disagree on a couple of points, though.&lt;br /&gt;&lt;br /&gt;I&amp;#39;m much, much, much more comfortable using fakes that maintain some amount of state than relying on the continued correctness of thousands of ad-hoc mocks objects. If the fake exposes more than a couple(!) of methods, I just add tests for the fake. I can run the tests against the real thing and against my fake, and see that they do the same thing. This pattern has served me quite well a number of times now. The amount of ad-hoc mock objects we have in Nova right now gives me the heebie jeebies. A method that mocks out a call to the db layer returning an object with an attribute that has since been moved could go unnoticed for months until some almost entirely unrelated change reveals that something has changed incompatibly. This is pain to clean up after.&lt;br /&gt;&lt;br /&gt;I disagree about your 80%/20% thing. I think unit tests are even *more* important for the things that only 20% of your users use. If the stuff that everyone uses breaks, you&amp;#39;ll find out in a jiffy and someone will always be up for contributing tests for that. The exotic stuff is exactly the sort of stuff you need help verifying.&lt;br /&gt;&lt;br /&gt;I think your example of a method that doesn&amp;#39;t need unit tests is much too general. Sure, I can think of many examples where such a method could acceptably be untested by unit tests, but in many cases, the correct, expected behaviour of that foo() method is exactly to execute those three methods in that exact order. If your mock library of choice doesn&amp;#39;t let you verify this easily, I&amp;#39;d certainly whip up an ad-hoc mock that does.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8696186/1478186483478607934/comments/default/974745948030930482'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8696186/1478186483478607934/comments/default/974745948030930482'/><link rel='alternate' type='text/html' href='http://www.sandywalsh.com/2011/06/effective-units-tests-and-integration.html?showComment=1321978124574#c974745948030930482' title=''/><author><name>Soren Hansen</name><uri>http://www.blogger.com/profile/14840088470490315368</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.sandywalsh.com/2011/06/effective-units-tests-and-integration.html' ref='tag:blogger.com,1999:blog-8696186.post-1478186483478607934' source='http://www.blogger.com/feeds/8696186/posts/default/1478186483478607934' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1693931139'/></entry><entry><id>tag:blogger.com,1999:blog-8696186.post-1323480556791340297</id><published>2011-07-14T15:00:23.197-03:00</published><updated>2011-07-14T15:00:23.197-03:00</updated><title type='text'>Great post Sandy!

You have a great way of breakin...</title><content type='html'>Great post Sandy!&lt;br /&gt;&lt;br /&gt;You have a great way of breaking this stuff down...&lt;br /&gt;&lt;br /&gt;On the mocking side, I&amp;#39;ve come to love mocking frameworks for doing stubbing instead of trying to create crufty mock implementations to maintain...mockito is my favorite.  I find that inline mock definition (ie when(mock.getSomething()).thenReturn(&amp;quot;something&amp;quot;)) much easier to use and maintain.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8696186/1478186483478607934/comments/default/1323480556791340297'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8696186/1478186483478607934/comments/default/1323480556791340297'/><link rel='alternate' type='text/html' href='http://www.sandywalsh.com/2011/06/effective-units-tests-and-integration.html?showComment=1310666423197#c1323480556791340297' title=''/><author><name>Shawn Crosby</name><uri>http://www.blogger.com/profile/12093823138737535996</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='06398137996676519531'/><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/__S14ux89bFY/Soabhg77_pI/AAAAAAAAAqs/N84Ol381kTA/S220/Picture+6.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.sandywalsh.com/2011/06/effective-units-tests-and-integration.html' ref='tag:blogger.com,1999:blog-8696186.post-1478186483478607934' source='http://www.blogger.com/feeds/8696186/posts/default/1478186483478607934' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1224855622'/></entry><entry><id>tag:blogger.com,1999:blog-8696186.post-6428437052196328134</id><published>2011-06-30T18:02:01.748-03:00</published><updated>2011-06-30T18:02:01.748-03:00</updated><title type='text'>Great post, Sandy!

One of the things I would ment...</title><content type='html'>Great post, Sandy!&lt;br /&gt;&lt;br /&gt;One of the things I would mention here is that the terminology around all of this is so loosely defined as to be stupid. &lt;br /&gt;&lt;br /&gt;In a previous life, we simply referred to tests as blackbox versus whitebox. The former was more like integration/functional whereas the latter was more like unit tests. In that same vein, the last couple months have in turn told me that the things I thought of as &amp;quot;integration&amp;quot; tests were truly functional tests, and vice versa. As such, I&amp;#39;ve personally come to define things &amp;quot;unit tests&amp;quot; and &amp;quot;not unit tests&amp;quot; for simplicity&amp;#39;s sake.&lt;br /&gt;&lt;br /&gt;Regarding mocks, I personally believe their value should be evaluated on a case-by-case basis, as they can lead to some incredibly brittle tests, especially if you&amp;#39;re enforcing the order of method calls. As for stubs, I&amp;#39;ve come to believe the only real difference between these and mocks is whether or not you verify the mock was called explicitly, and what parameters the mock actually received. One of the testing frameworks I&amp;#39;ve used in Ruby made this same distinction: stubs only returned a value necessary for a test, whereas a mock would vet the input and place a hard requirement on whether or not it was called.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8696186/1478186483478607934/comments/default/6428437052196328134'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8696186/1478186483478607934/comments/default/6428437052196328134'/><link rel='alternate' type='text/html' href='http://www.sandywalsh.com/2011/06/effective-units-tests-and-integration.html?showComment=1309467721748#c6428437052196328134' title=''/><author><name>Matt</name><uri>http://www.blogger.com/profile/12923314126338489746</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.sandywalsh.com/2011/06/effective-units-tests-and-integration.html' ref='tag:blogger.com,1999:blog-8696186.post-1478186483478607934' source='http://www.blogger.com/feeds/8696186/posts/default/1478186483478607934' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-331269287'/></entry></feed>
