The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
rcov 0.7.0: code coverage and callsite/defsite data aggregation across multiple runs

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.
rcov 0.7.0: code coverage and callsite/defsite data aggregation across multiple runs Posted: Aug 4, 2006 2:48 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Eigen Class.
Original Post: rcov 0.7.0: code coverage and callsite/defsite data aggregation across multiple runs
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 0.7.0 can aggregate code coverage and defsite/callsite data collected in successive runs. This is useful when you want to obtain a global coverage rate but your tests are split into several parts, for instance units, functionals and integration, as happens in Rails.

Here's how you'd define coverage tasks for unit, functional and integration tests under the test:coverage namespace, as well as a test:coverage task that runs them all and yields an aggregate coverage rate:

require 'rcov/rcovtask'

namespace :test do 
  namespace :coverage do
    desc "Delete aggregate coverage data."
    task(:clean) { rm_f "coverage.data" }
  end
  desc 'Aggregate code coverage for unit, functional and integration tests'
  task :coverage => "test:coverage:clean"
  %w[unit functional integration].each do |target|
    namespace :coverage do
      Rcov::RcovTask.new(target) do |t|
        t.libs << "test"
        t.test_files = FileList["test/#{target}/*_test.rb"]
        t.output_dir = "test/coverage/#{target}"
        t.verbose = true
        t.rcov_opts << '--rails --aggregate coverage.data'
      end
    end
    task :coverage => "test:coverage:#{target}"
  end
end

All you have to do to combine data from multiple runs is to add

 --aggregate FILE

so that the data from previous runs saved in FILE is loaded (if FILE doesn't exist then history will be empty), merged with the newer information and stored back into FILE:


Read more...

Read: rcov 0.7.0: code coverage and callsite/defsite data aggregation across multiple runs

Topic: RubyConf 2006 Registration is Open Previous Topic   Next Topic Topic: Serious About Agile

Sponsored Links



Google
  Web Artima.com   

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