<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Philip Yurchuk &#187; unit testing</title>
	<atom:link href="http://philip.yurchuk.com/tag/unit-testing/feed/" rel="self" type="application/rss+xml" />
	<link>http://philip.yurchuk.com</link>
	<description>Software Development Blog</description>
	<lastBuildDate>Sun, 13 Sep 2009 07:32:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>When Do You Stop Adding Unit Tests?</title>
		<link>http://philip.yurchuk.com/2009/02/07/when-do-you-stop-adding-unit-tests/</link>
		<comments>http://philip.yurchuk.com/2009/02/07/when-do-you-stop-adding-unit-tests/#comments</comments>
		<pubDate>Sat, 07 Feb 2009 12:20:03 +0000</pubDate>
		<dc:creator>Philip Yurchuk</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[unit testing]]></category>

		<guid isPermaLink="false">http://philip.yurchuk.com/?p=28</guid>
		<description><![CDATA[Joel Spolsky recently posted a transcript of a conversation he and Jeff Atwood had on the Stack Overflow podcast.Â  It&#8217;s a nice reminder to think about the situations where unit tests add value and where they add maintenance hassle. The takeaway was that there are a few places where code coverage makes a lot of [...]]]></description>
			<content:encoded><![CDATA[<p>Joel Spolsky recently posted a <a title="Stack Overflow podcast transcript" href=" http://www.joelonsoftware.com/items/2009/01/31.html">transcript of a conversation</a> he and Jeff Atwood had on the Stack Overflow podcast.Â  It&#8217;s a nice reminder to think about the situations where unit tests add value and where they add maintenance hassle.</p>
<p>The takeaway was that there are a few places where code coverage makes a lot of sense because change is rare and breakage has a big negative impact. These include APIs, especially plugin architectures where others are depending on the contract of your code, and mature business logic that should rarely change.<sup>1</sup> You really want to think about the number of people or LOC that are depending on that code to work.</p>
<p>In contrast, there are a lot <strong>more </strong>places where you&#8217;re slowing down your coders and their ability to respond to customer needs.</p>
<p>Another contradiction Spolsky suggests: many of the same agile programmers who espouse <a href="http://en.wikipedia.org/wiki/YAGNI">YAGNI</a> require an arbitrary percentage for code coverage (often close to 100%). Shouldn&#8217;t YAGNI also apply to unit tests?</p>
<p>I believe the key is simply thinking about what you&#8217;re doing. Here are some guidelines:</p>
<ul>
<li>If it&#8217;s foundation code (frameworks, libraries, etc. &#8211; anything that gets called a lot) write the tests.</li>
<li>If you&#8217;re about to refactor the code, write the tests.</li>
<li>Even if you&#8217;re not going to write the test, channel the spirit of Test First Development &#8211; design the code so that it&#8217;s easy to unit test should you have to later on.</li>
</ul>
<p>I realize this might sound obvious, but a) not everyone agrees with this, and b) sometimes you can lose sight of what&#8217;s &#8220;obvious&#8221; when others are persuasively defending blind adherence to &#8220;principles&#8221;. </p>
<ol class="footnotes"><li id="footnote_0_28" class="footnote">Like, say, the state mandated 7-day waiting period for the purchase of weasels.</li></ol>]]></content:encoded>
			<wfw:commentRss>http://philip.yurchuk.com/2009/02/07/when-do-you-stop-adding-unit-tests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
