<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><title type="text">WeirdLooking.com: Michael Barton's Blog</title><rights>Copyright 2006</rights><author><name>Michael Barton</name><email>palrich@gmail.com</email></author><updated>2010-09-07T14:08:44Z</updated><generator>WeirdLooking.com</generator><logo>http://www.weirdlooking.com/images/feed.png</logo><link rel="alternate" type="text/html" href="http://www.weirdlooking.com/" /><link rel="self" type="application/xml+atom" href="http://www.weirdlooking.com/atom/tag/unit%20tests" /><id>http://www.weirdlooking.com/</id><entry><title type="text">glass box unit testing can bite me</title><author><name>Michael Barton</name></author><link rel="alternate" type="text/html" href="http://www.weirdlooking.com/blog/glass-box-unit-testing-can-bite-me" /><id>http://www.weirdlooking.com/blog/glass-box-unit-testing-can-bite-me</id><published>2008-04-24T09:32:37Z</published><updated>2008-04-24T09:32:37Z</updated><content type="html">I&amp;rsquo;ve seen unit tests where everything touched by the code is mocked out, and the mocks are intelligent in such a way that the tests fail if the mocked methods aren&amp;rsquo;t all called with correct arguments.&amp;nbsp; It winds up being nearly a line for line check of the implementation of the code, and is about the most horrible thing I think I&amp;rsquo;ve ever heard of.&lt;br /&gt;&lt;br /&gt;I have basically the same problem with tests against private methods.&lt;br /&gt;&lt;br /&gt;Changing implementation details without changing behavior called &amp;ldquo;refactoring&amp;rdquo; and is one of the selling points of unit tests.&amp;nbsp; If a class behaves exactly the same today as it did yesterday, its unit tests shouldn&amp;rsquo;t suddenly &lt;span style=&quot;font-style: italic;&quot;&gt;fail&lt;/span&gt;, even if someone was mucking around inside it.&lt;br /&gt;&lt;br /&gt;If you just want to make sure nobody changes the code, why not get a checksum of the file?&amp;nbsp; It&amp;rsquo;ll be a lot less work and have about the same effect.&amp;nbsp; Ta freakin&amp;#39; da.&lt;br /&gt;&lt;br /&gt;And I&amp;rsquo;m not saying that there aren&amp;rsquo;t exceptions, just that they &lt;span style=&quot;font-style: italic;&quot;&gt;are&lt;/span&gt; exceptions.</content><category term="programming" /><category term="unit tests" /><link rel="comments" type="application/atom+xml" href="http://www.weirdlooking.com/atom/comments/102" /><wfw:commentRss>http://www.weirdlooking.com/atom/comments/102</wfw:commentRss><slash:comments>1</slash:comments></entry></feed>