The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Better code coverage for Ruby: rcov 0.1.0 prerelease

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Eigen Class

Posts: 358
Nickname: eigenclass
Registered: Oct, 2005

Eigenclass is a hardcore Ruby blog.
Better code coverage for Ruby: rcov 0.1.0 prerelease Posted: Jan 23, 2006 9:49 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Eigen Class.
Original Post: Better code coverage for Ruby: rcov 0.1.0 prerelease
Feed Title: Eigenclass
Feed URL: http://feeds.feedburner.com/eigenclass
Feed Description: Ruby stuff --- trying to stay away from triviality.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Eigen Class
Latest Posts From Eigenclass

Advertisement

rcov is a code coverage tool for Ruby I originally wrote 2 years ago. It improves on the better known coverage in a number of points:

  • 20-300 times faster
  • more accurate coverage information through code linkage inference using simple heuristics
  • slightly more convenient interface (arguably; work on this is probably needed)
  • additional features like bogo-profile mode, colorblind-safeness...

Code coverage shouldn't be abused (in few words, C0 coverage guarantees nothing) but it's still useful for testing: it will at least tell you when your tests need more work, and most importantly where.

What does it look like?

Just use rcov to run your program (instead of Ruby), and a number of XHTML files with the code coverage information will be generated.

For example, given

srand(0)
c = 0
d = 1
10.times do |i|
  if rand % (i + 10)
    c += i
    d += 1
  end
end
puts "blergh"
if c > 4*d
  # stuff
  puts "yep"
else
  puts "nope"
  # more stuff
end

puts "Done: #{c+d}"

you'll get something resembling screenshot.png


Read more...

Read: Better code coverage for Ruby: rcov 0.1.0 prerelease

Topic: Mark Cuban Mentions Rails Previous Topic   Next Topic Topic: Agile Web Dev w/Rails: slight oversight with its file upload sample…

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use