<?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>out &#62;&#62; m_Conscientia; &#187; code coverage</title>
	<atom:link href="http://blog.hypercomplex.co.uk/index.php/tag/code-coverage/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.hypercomplex.co.uk</link>
	<description>a multidimensional braindump</description>
	<lastBuildDate>Mon, 02 Aug 2010 22:30:54 +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>Code Coverage in Visual Studio 2010 Beta 2</title>
		<link>http://blog.hypercomplex.co.uk/index.php/2009/12/code-coverage-in-visual-studio-2010-beta-2/</link>
		<comments>http://blog.hypercomplex.co.uk/index.php/2009/12/code-coverage-in-visual-studio-2010-beta-2/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 21:38:05 +0000</pubDate>
		<dc:creator>Alex Peck</dc:creator>
				<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[2010]]></category>
		<category><![CDATA[code coverage]]></category>
		<category><![CDATA[visual studio]]></category>

		<guid isPermaLink="false">http://blog.hypercomplex.co.uk/?p=645</guid>
		<description><![CDATA[I spent a while trying to enable code coverage in Visual Studio 2010 Beta 2. After I ran my unit tests, when I tried to view the code coverage I got this message: Empty results generated: none of the instrumented binary was used. Look at test run details for any instrumentation problems. In LocalTestRun.testrunconfig I [...]]]></description>
			<content:encoded><![CDATA[<p>I spent a while trying to enable code coverage in Visual Studio 2010 Beta 2. After I ran my unit tests, when I tried to view the code coverage I got this message:</p>
<p><em>Empty results generated: none of the instrumented binary was used. Look at test run details for any instrumentation problems.</em>			</p>
<p>In LocalTestRun.testrunconfig I had code coverage enabled, but it took me a few attempts to realise how to get to the page where you can select which artifacts to instrument.</p>
<div id="attachment_646" class="wp-caption alignleft" style="width: 310px"><a href="http://blog.hypercomplex.co.uk/index.php/2009/12/code-coverage-in-visual-studio-2010-beta-2/shot/" rel="attachment wp-att-646"><img src="http://blog.hypercomplex.co.uk/wp-content/uploads/2009/11/shot-300x220.jpg" alt="Double click code coverage row to get to next page" title="Data &amp; Diagnostics" width="300" height="220" class="size-medium wp-image-646" /></a><p class="wp-caption-text">Double click code coverage row to get to next page</p></div>
<p>I&#8217;m not really too sure what visual cues indicate that I can double click the row to open the code coverage detail page. This is poor UI, hopefully it will be changed prior to release.</p>
<div id="attachment_651" class="wp-caption alignleft" style="width: 310px"><a href="http://blog.hypercomplex.co.uk/index.php/2009/12/code-coverage-in-visual-studio-2010-beta-2/shot-2/" rel="attachment wp-att-651"><img src="http://blog.hypercomplex.co.uk/wp-content/uploads/2009/11/shot1-300x203.jpg" alt="Then choose which artifacts to instrument here" title="Code Coverage Detail" width="300" height="203" class="size-medium wp-image-651" /></a><p class="wp-caption-text">Choose which artifacts to instrument here</p></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.hypercomplex.co.uk/index.php/2009/12/code-coverage-in-visual-studio-2010-beta-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>100% code coverage</title>
		<link>http://blog.hypercomplex.co.uk/index.php/2009/09/100pc-code-coverage/</link>
		<comments>http://blog.hypercomplex.co.uk/index.php/2009/09/100pc-code-coverage/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 21:31:45 +0000</pubDate>
		<dc:creator>Alex Peck</dc:creator>
				<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[code coverage]]></category>
		<category><![CDATA[Unit Testing]]></category>

		<guid isPermaLink="false">http://blog.hypercomplex.co.uk/?p=526</guid>
		<description><![CDATA[Unit tests can&#8217;t expose bugs in code they don&#8217;t execute. Therefore, unit tests should have a high degree of code coverage. If you test first, inject all dependencies and use mocks, 100% block coverage isn&#8217;t an onerous a goal. But what does block coverage really tell you? The answer is not much. It&#8217;s easy to [...]]]></description>
			<content:encoded><![CDATA[<p>Unit tests can&#8217;t expose bugs in code they don&#8217;t execute. Therefore, unit tests should have a high degree of code coverage. If you test first, <a href="http://blog.hypercomplex.co.uk/index.php/2009/06/dependency-injection-testability/">inject all dependencies</a> and use mocks, 100% block coverage isn&#8217;t an onerous a goal. But what does block coverage really tell you?</p>
<p>The answer is not much. It&#8217;s easy to spot which code you didn&#8217;t execute. For code that did execute, if neither the behaviour nor resultant state is verified, all you really know is that there were no unexpected errors. In other words, this code coverage is merely <a href="http://jasonrudolph.com/blog/2008/06/17/testing-anti-patterns-incidental-coverage/">incidental</a>, and no actual testing took place.</p>
<p>Furthermore, even with 100% coverage you have no indication of the code you should have written, but didn&#8217;t. For example, consider this simple one liner:</p>

<div class="wp_codebox"><table><tr id="p5262"><td class="code" id="p526code2"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">float</span> Divide<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">float</span> dividend, <span style="color: #6666cc; font-weight: bold;">float</span> divisor<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
   <span style="color: #0600FF; font-weight: bold;">return</span> dividend <span style="color: #008000;">/</span> divisor<span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> TestDivide<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
   <span style="color: #6666cc; font-weight: bold;">float</span> quotient <span style="color: #008000;">=</span> Divide<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">10</span>, <span style="color: #FF0000;">2</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
   Assert<span style="color: #008000;">.</span><span style="color: #0000FF;">AreEqual</span><span style="color: #008000;">&lt;</span><span style="color: #6666cc; font-weight: bold;">float</span><span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">5</span>, quotient<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>The test case gives us 100% block coverage. However, we will get different behaviour if we use a divisor of 0. This different behaviour may very well constitute a bug. Interestingly, we won&#8217;t find this bug even if we use a more robust coverage metric (e.g path coverage) because it is a boundary problem.</p>
<p><!-- http://panela.blog-city.com/pycon2008_video_of_managing_complexity_up.htm --></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.hypercomplex.co.uk/index.php/2009/09/100pc-code-coverage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dependency Injection &amp; Testability</title>
		<link>http://blog.hypercomplex.co.uk/index.php/2009/06/dependency-injection-testability/</link>
		<comments>http://blog.hypercomplex.co.uk/index.php/2009/06/dependency-injection-testability/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 19:01:06 +0000</pubDate>
		<dc:creator>Alex Peck</dc:creator>
				<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[code coverage]]></category>
		<category><![CDATA[Dependency Injection]]></category>
		<category><![CDATA[talk]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[Unit Testing]]></category>

		<guid isPermaLink="false">http://blog.hypercomplex.co.uk/?p=111</guid>
		<description><![CDATA[When objects have no (or few) collaborators it&#8217;s relatively easy to get high unit test code coverage. As the number and complexity of collaborators increases, so too does the difficulty in obtaining decent coverage. This talk illustrates why dependency injection principles improve the testability of your code, and ease mock/stub based unit testing.]]></description>
			<content:encoded><![CDATA[<p>When objects have no (or few) collaborators it&#8217;s relatively easy to get high unit test code coverage. As the number and complexity of collaborators increases, so too does the difficulty in obtaining decent coverage. This talk illustrates why dependency injection principles improve the testability of your code, and ease <a href="http://martinfowler.com/articles/mocksArentStubs.html" target="_blank">mock/stub based unit testing</a>.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://www.youtube.com/v/RlfLCWKxHJ0&amp;color1=0xb1b1b1&amp;color2=0xcfcfcf&amp;hl=en&amp;feature=player_embedded&amp;fs=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/RlfLCWKxHJ0&amp;color1=0xb1b1b1&amp;color2=0xcfcfcf&amp;hl=en&amp;feature=player_embedded&amp;fs=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.hypercomplex.co.uk/index.php/2009/06/dependency-injection-testability/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Code Coverage in VSTS 2005</title>
		<link>http://blog.hypercomplex.co.uk/index.php/2009/02/code-coverage-in-vsts-2005/</link>
		<comments>http://blog.hypercomplex.co.uk/index.php/2009/02/code-coverage-in-vsts-2005/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 15:30:46 +0000</pubDate>
		<dc:creator>Alex Peck</dc:creator>
				<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[code coverage]]></category>
		<category><![CDATA[team system]]></category>
		<category><![CDATA[visual studio]]></category>

		<guid isPermaLink="false">http://www.blog.hypercomplex.co.uk/?p=5</guid>
		<description><![CDATA[I&#8217;m measuring test code coverage on an application stack with both .NET (managed) and native (unmanaged) components. For some reason the help doesn&#8217;t explicitly state how this is accomplished, and some googling suggested that you need to go outside the IDE to instrument the native code. This isn&#8217;t the case. With a Visual Studio 2005 [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m measuring test code coverage on an application stack with both .NET (managed) and native (unmanaged) components. For some reason the help doesn&#8217;t explicitly state how this is accomplished, and some googling suggested that you need to go outside the IDE to instrument the native code.</p>
<p>This isn&#8217;t the case. With a Visual Studio 2005 solution consisting of:</p>
<ul>
<li>a native .dll project</li>
<li>a .NET .dll project</li>
<li>an mstest project</li>
</ul>
<p>Instrumentation can be enabled by editing the localtestrun.testrunconfig solution item. Look for the code coverage section and select the artifacts you want to instrument. <strong></strong></p>
<p><strong>Caveat</strong>: the native binary will not be instrumented unless it is linked with the /PROFILE switch. There is no error message if you forget, it just silently fails to collect coverage for the .dll.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.hypercomplex.co.uk/index.php/2009/02/code-coverage-in-vsts-2005/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
