<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: RCOV C0 line coverage more generous than EMMA&#8217;s C1 line coverage</title>
	<atom:link href="http://www.pervasivecode.com/blog/2007/07/11/rcov-c0-line-coverage-more-generous-than-emmas-c1-bytecode-coverage/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pervasivecode.com/blog/2007/07/11/rcov-c0-line-coverage-more-generous-than-emmas-c1-bytecode-coverage/</link>
	<description>Jamie Flournoy's Software Development Blog</description>
	<lastBuildDate>Mon, 02 Aug 2010 14:57:29 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Jamie Flournoy</title>
		<link>http://www.pervasivecode.com/blog/2007/07/11/rcov-c0-line-coverage-more-generous-than-emmas-c1-bytecode-coverage/comment-page-1/#comment-325</link>
		<dc:creator>Jamie Flournoy</dc:creator>
		<pubDate>Sun, 05 Aug 2007 04:20:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.pervasivecode.com/blog/2007/07/11/rcov-c0-line-coverage-more-generous-than-emmas-c1-bytecode-coverage/#comment-325</guid>
		<description>&gt;I’m wondering why you didn’t point that out?
I linked right to the very thing you&#039;re saying I failed to point out.

Here&#039;s what you&#039;re apparently not grasping: the EMMA web site doesn&#039;t talk about rcov, and the rcov web site doesn&#039;t talk about EMMA. Likewise with Clover. The web sites for EMMA and Clover don&#039;t talk about their functionality in terms of C0 vs. C1 vs. C2, but rcov does.

This post *compares* EMMA and rcov, and uses the *same terminology* (C0/C1) on both, with an identical code example for 2 different programming languages. I also talk about reasonable expectations for coverage % based on personal experience.</description>
		<content:encoded><![CDATA[<p>>I’m wondering why you didn’t point that out?<br />
I linked right to the very thing you&#8217;re saying I failed to point out.</p>
<p>Here&#8217;s what you&#8217;re apparently not grasping: the EMMA web site doesn&#8217;t talk about rcov, and the rcov web site doesn&#8217;t talk about EMMA. Likewise with Clover. The web sites for EMMA and Clover don&#8217;t talk about their functionality in terms of C0 vs. C1 vs. C2, but rcov does.</p>
<p>This post *compares* EMMA and rcov, and uses the *same terminology* (C0/C1) on both, with an identical code example for 2 different programming languages. I also talk about reasonable expectations for coverage % based on personal experience.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jim Deville</title>
		<link>http://www.pervasivecode.com/blog/2007/07/11/rcov-c0-line-coverage-more-generous-than-emmas-c1-bytecode-coverage/comment-page-1/#comment-322</link>
		<dc:creator>Jim Deville</dc:creator>
		<pubDate>Sun, 05 Aug 2007 01:21:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.pervasivecode.com/blog/2007/07/11/rcov-c0-line-coverage-more-generous-than-emmas-c1-bytecode-coverage/#comment-322</guid>
		<description>I just wanted to point out that even the creator of rcov points this out. The page you link to goes on to explain C0, C1, and C2 coverage. I&#039;m wondering why you didn&#039;t point that out?</description>
		<content:encoded><![CDATA[<p>I just wanted to point out that even the creator of rcov points this out. The page you link to goes on to explain C0, C1, and C2 coverage. I&#8217;m wondering why you didn&#8217;t point that out?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://www.pervasivecode.com/blog/2007/07/11/rcov-c0-line-coverage-more-generous-than-emmas-c1-bytecode-coverage/comment-page-1/#comment-272</link>
		<dc:creator>John</dc:creator>
		<pubDate>Wed, 01 Aug 2007 04:30:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.pervasivecode.com/blog/2007/07/11/rcov-c0-line-coverage-more-generous-than-emmas-c1-bytecode-coverage/#comment-272</guid>
		<description>My last comments formatting didn&#039;t work so well. Maybe this will be better.

===

Hi Jamie,

Perhaps you know about this already, but if not...

You wrote:

====
There’s a little voice in my head that says, “Come on, you slacker, you should make it possible to dynamically break the database configuration and remount the root filesystem as read-only during the test suite so that the error handlers can all be 100% covered!”
====

One thing that I&#039;ve done to increase test coverage is to reopen classes, and redefine methods that allow me to fail certain operations (for instance saving). Here&#039;s an example:

class PictureStream
  cattr_accessor :fail_saves
  @@fail_saves = false

  alias_method :unaliased_save, :save
  def save(param = nil)
    return unaliased_save unless @@fail_saves
    false
  end
end

This code goes inside one of my tests (test/units/whatever_test.rb), and when I have a test for failing to save, the code does this:

    PictureStream.fail_saves = true
    ... do the operation ...
    ... check that it failed ...

When I run rcov on these tests, it tells me that the test did indeed cover the case where a save failed, allowing me at least some sense that things are working right.

Perhaps you&#039;d seen this before, and I know it won&#039;t help to produce a read only root filesystem, but I found it really useful to push up the amount of code that was covered by my tests.</description>
		<content:encoded><![CDATA[<p>My last comments formatting didn&#8217;t work so well. Maybe this will be better.</p>
<p>===</p>
<p>Hi Jamie,</p>
<p>Perhaps you know about this already, but if not&#8230;</p>
<p>You wrote:</p>
<p>====<br />
There’s a little voice in my head that says, “Come on, you slacker, you should make it possible to dynamically break the database configuration and remount the root filesystem as read-only during the test suite so that the error handlers can all be 100% covered!”<br />
====</p>
<p>One thing that I&#8217;ve done to increase test coverage is to reopen classes, and redefine methods that allow me to fail certain operations (for instance saving). Here&#8217;s an example:</p>
<p>class PictureStream<br />
  cattr_accessor :fail_saves<br />
  @@fail_saves = false</p>
<p>  alias_method :unaliased_save, :save<br />
  def save(param = nil)<br />
    return unaliased_save unless @@fail_saves<br />
    false<br />
  end<br />
end</p>
<p>This code goes inside one of my tests (test/units/whatever_test.rb), and when I have a test for failing to save, the code does this:</p>
<p>    PictureStream.fail_saves = true<br />
    &#8230; do the operation &#8230;<br />
    &#8230; check that it failed &#8230;</p>
<p>When I run rcov on these tests, it tells me that the test did indeed cover the case where a save failed, allowing me at least some sense that things are working right.</p>
<p>Perhaps you&#8217;d seen this before, and I know it won&#8217;t help to produce a read only root filesystem, but I found it really useful to push up the amount of code that was covered by my tests.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
