The new home of RCov on GitHub
The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:
This is our fork of Mauricio Fernandez's RCov (maintained by Relevance).
NOTE: This fork does not work on Ruby 1.9.x. For coverage on Ruby 1.9 look at SimpleCov.
gem install rcov
rcov copyright (c) 2004-2012 Mauricio Fernandez [email protected] rcov copyright (c) 2008-2012 Aaron Bedra and Relevance Inc.
Rcovis a code coverage tool for
Ruby. It is commonly used for viewing overall test coverage of target code. It features:
De-compress the archive and enter its top directory. Then type:
($ su) # ruby setup.rb
This simple step installs rcov under the default location for Ruby libraries. You can also customize the installation by supplying some options to setup.rb. Try
ruby setup.rb --help.
A normal (rcovrt-enabled) install requires Ruby >= 1.8.6 and a working C toolchain; if you cannot compile Ruby extensions proceed as described below.
($su ) # ruby setup.rb all --without-ext
will install rcov without building the rcovrt extension.
In the common scenario, your tests are under
test/and the target code (whose coverage you want) is in
lib/. In that case, all you have to do is use rcov to run the tests (instead of testrb), and a number of XHTML files with the code coverage information will be generated, e.g.
rcov -Ilib test/*.rb
will execute all the
test/and generate the code coverage report for the target code (i.e. for the files in
coverage/. The target code needs not be under
lib/; rcov will detect is as long as it is
required by the tests. rcov is smart enough to ignore "uninteresting" files: the tests themselves, files installed in Ruby's standard locations, etc. See
rcov --helpfor the list of regexps rcov matches filenames against.
rcov can also be used from
RDocdocumentation for more information. The
Rakefileincluded in rcov's sources holds a few tasks that run rcov on itself, producing a number of reports. You can try
preferably after a full install or
ruby setup.rb config ruby setup.rb setup
so that the rcovrt extension can be used to speed up the process. This will generate a cross-referenced XHTML report under
rcov can output information in several formats, and perform different kinds of analyses in addition to plain code coverage. See
rcov --helpfor a description of the available options.
rcov is licensed under the same terms as Ruby. See LICENSE.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.