Source code, additional information, screenshots... available at http://eigenclass.org/hiki.rb?rcov Release information: http://eigenclass.org/hiki.rb?rcov+0.3.0 If you're on win32, you can also find a pre-built rcovrt.so (which makes code coverage analysis >100 times faster) in the above-mentioned pages. Overview -------- rcov is a tool for simple code coverage analysis in Ruby. It features: * fast execution: 20-300 times faster than previous tools * multiple analysis modes * more accurate coverage information through code linkage inference using simple heuristics * XHTML, plain text, ANSI-escaped text outputs * convenient interface * colorblind-friendliness What's new in 0.3.0 ------------------- A change summary can be found at http://eigenclass.org/hiki.rb?rcov+0.3.0 Even shorter summary: rcov 0.3.0 introduces a number of features that simplify the analysis of Rails applications. The new code coverage analysis mode, --test-unit-only, records exclusively code executed inside Test::Unit::TestCase(s). Another important addition is the ability to detect aliased source files: this was very needed to analyze Rails apps, where a file could get loaded under several different names, due to the extensive usage of #require with relative paths. Features * --exclude-only * consolidate multiple references to the same underlying .rb file (much needed for Rails) * --test-unit-only Fixes * consider and/op operators * honor --no-color in (rich) text mode * output valid XHTML indices Thanks (do tell if I forgot to list your name) ------ Tom Dolbilin: * identified and fixed backslash problem on win32 for generated filenames Andrew K.: * made the index XHTML compliant * consolidate multiple references to the same underlying .rb file Robert F.: * pointed me to dynamic uses of the tracing hooks, provided the inspiration for RCOV__.run_hooked 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.
on 2006-05-05 13:44