M
Mauricio Fernandez
Source code, additional information, screenshots... available at
http://eigenclass.org/hiki.rb?rcov
Overview
--------
rcov is a tool for simple code coverage analysis in Ruby. It improves on
the better known coverage[1] in a number of ways:
* 20-300 times faster: typically, the program being inspect runs only ~3
times slower than without rcov (i.e. not 200 times slower as with
some other tools)
* more convenient interface
* prettier output (since 0.2.0)
* more accurate coverage information through code linkage inference using
simple heuristics
* additional features like bogo-profile mode, colorblind-friendliness...
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's new in 0.2.0
-------------------
A change summary is available at
http://eigenclass.org/hiki.rb?rcov+0.2.0
Visible changes since 0.1.0:
* improved HTML output (cleaner and more readable) --- using xx under the hood
* textual output: execution counts or code decorated with ANSI sequences
* more convenient interface: run several scripts/tests in one go, argument
propagation...
Downloading
-----------
The last version is available at
http://eigenclass.org/hiki.rb?rcov
How do I use it? 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, e.g.
rcov test/*.rb
will execute all the .rb files under test/ and generate the code coverage report
under coverage/. rcov can also operate in "bogo-profiling mode"
and output the relevant information in alternative formats (for the time
being, plain text with execution count annotations and colored text). Use
rcov -h
for more information.
Sample output
-------------
See http://eigenclass.org/hiki.rb?rcov (once again) for screenshots.
The (undecorated) textual output with execution count information looks like this:
$ rcov --no-html -t b.rb
================================================================================
./b.rb
================================================================================
| 2
a, b, c = (1..3).to_a | 2
10.times do | 1
a += 1 | 10
20.times do |i| | 10
b += i | 200
b.times do | 200
c += (j = (b-a).abs) > 0 ? j : 0 | 738800
end | 0
end | 0
end | 0
License
-------
rcov is released under the terms of Ruby's license.
rcov includes xx 0.1.0, which is subject to the following conditions:
ePark Labs Public License version 1
Copyright (c) 2005, ePark Labs, Inc. and contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of ePark Labs nor the names of its contributors may be
used to endorse or promote products derived from this software without
specific prior written permission.
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.
[1] http://freshmeat.net/projects/rubycoverage
http://eigenclass.org/hiki.rb?rcov
Overview
--------
rcov is a tool for simple code coverage analysis in Ruby. It improves on
the better known coverage[1] in a number of ways:
* 20-300 times faster: typically, the program being inspect runs only ~3
times slower than without rcov (i.e. not 200 times slower as with
some other tools)
* more convenient interface
* prettier output (since 0.2.0)
* more accurate coverage information through code linkage inference using
simple heuristics
* additional features like bogo-profile mode, colorblind-friendliness...
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's new in 0.2.0
-------------------
A change summary is available at
http://eigenclass.org/hiki.rb?rcov+0.2.0
Visible changes since 0.1.0:
* improved HTML output (cleaner and more readable) --- using xx under the hood
* textual output: execution counts or code decorated with ANSI sequences
* more convenient interface: run several scripts/tests in one go, argument
propagation...
Downloading
-----------
The last version is available at
http://eigenclass.org/hiki.rb?rcov
How do I use it? 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, e.g.
rcov test/*.rb
will execute all the .rb files under test/ and generate the code coverage report
under coverage/. rcov can also operate in "bogo-profiling mode"
and output the relevant information in alternative formats (for the time
being, plain text with execution count annotations and colored text). Use
rcov -h
for more information.
Sample output
-------------
See http://eigenclass.org/hiki.rb?rcov (once again) for screenshots.
The (undecorated) textual output with execution count information looks like this:
$ rcov --no-html -t b.rb
================================================================================
./b.rb
================================================================================
| 2
a, b, c = (1..3).to_a | 2
10.times do | 1
a += 1 | 10
20.times do |i| | 10
b += i | 200
b.times do | 200
c += (j = (b-a).abs) > 0 ? j : 0 | 738800
end | 0
end | 0
end | 0
License
-------
rcov is released under the terms of Ruby's license.
rcov includes xx 0.1.0, which is subject to the following conditions:
ePark Labs Public License version 1
Copyright (c) 2005, ePark Labs, Inc. and contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of ePark Labs nor the names of its contributors may be
used to endorse or promote products derived from this software without
specific prior written permission.
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.
[1] http://freshmeat.net/projects/rubycoverage