asplake

Friday, January 06, 2006

100% test coverage with rcov

Further to my previous post, coverage is now at 100%.

Fixing that last 4% was mostly a matter of:

  • finishing the writing of my tests (obviously). The missing ones were for the post actions in my main controller
  • excluding the standard config files boot.rb and environment.rb from the report, the former because of some standard platform-specific stuff (unreachable in my setup) and the second because (bizarrely) it reported that I wasn't achieving full coverage of its comments! Added --exclude boot.rb,environment.rb as the first argument to rcov.

There was also an issue with code of the following form:

  x = y.collect do |i|
    i.to_s
  end.join("/")

For some reason, rcov failed to recognise the execution of the last line. I had good reason to rewrite this, so I haven't investigated this any further.

Technorati tags:

1 Comments:

  • it seems a parameter "--rails" would replace your --exclude option...

    except that I can't seem to have any effect on my results with either option :(

    By Blogger Unknown, at 4:39 pm  

Post a Comment

<< Home