---
name: "rcov"
section: "1"
platform: "linux"
package: "rcov"
version: "1.0-2"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/rcov"
---

# rcov(1)

create a code coverage report for Ruby tests

## NAME

**rcov** - create a code coverage report for Ruby tests

## SYNOPSIS

```
rcov [options] <script1.rb> [script2.rb] [-- --extra-options]
```

## DESCRIPTION

**rcov is a code coverage tool for Ruby. It creates code coverage reports** **showing the unit test coverage of the target code.**

**rcov does "statement coverage", also referred to as "C0 coverage analysis".** **It tests, if each line of the source code has been executed.**

**rcov is typically used to find the areas of a program that have not been** **sufficiently tested. It reports, what code has not been run by any test** **cases.**

**It can easily be integrated into build processes (e.g. with rake or rant) and** **creates the coverage reports in HTML or text format.**

## OPTIONS

- **-o, --output**

  **Destination directory.**

- **-I, --include PATHS**

  **Prepend PATHS to $: (colon separated list)**

- **--\[no-\]comments**

  **Mark all comments by default. (default: --no-comments)**

- **--test-unit-only**

  **Only trace code executed inside TestCases.**

- **--spec-only**

  **Only trace code executed inside RSpec specs.**

- **-n, --no-color**

  **Create colorblind-safe output.**

- **-i, --include-file PATTERNS**

  **Generate info for files matching a pattern (comma-separated regexp list)**

- **-x, --exclude PATTERN**

  **Don't generate info for files matching a pattern (comma-separated regexp** **list)**

- **--exclude-only PATTERNS**

  **Skip info only for files matching the given patterns.**

- **--rails**

  **Skip config/, environment/ and vendor/.**

- **--\[no-\]callsites**

  **Show callsites in generated XHTML report. (somewhat slower; disabled by** **default)**

- **--\[no-\]xrefs**

  **Generate fully cross-referenced report. (includes --callsites)**

- **-p, --profile**

  **Generate bogo-profiling info.**

- **-r, --range RANGE**

  **Color scale range for profiling info (dB).**

- **-a, --annotate**

  **Generate annotated source code.**

- **-T, --text-report**

  **Dump detailed plain-text report to stdout. (filename, LoC, total lines,** **coverage)**

- **-t, --text-summary**

  **Dump plain-text summary to stdout.**

- **--text-counts**

  **Dump execution counts in plaintext.**

- **--text-coverage**

  **Dump coverage info to stdout, using ANSI color sequences unless -n.**

- **--gcc**

  **Dump uncovered line in GCC error format.**

- **--aggregate FILE**

  **Aggregate data from previous runs in FILE. Overwrites FILE with the** **merged data. FILE is created if necessary.**

- **-D, --text-coverage-diff \[FILE\]**

  **Compare code coverage with saved state in FILE, defaults to coverage.info.** **Implies --comments.**

- **--save \[FILE\]**

  **Save coverage data to FILE, for later use with rcov -D.** **(default: coverage.info)**

- **--\[no-\]html**

  **Generate HTML output. (default: --html)**

- **--css relative/path/to/custom.css**

  **Use a custom CSS file for HTML output.** **Specified as a relative path.**

- **--sort CRITERION**

  **Sort files in the output by the specified field (name, loc, coverage)**

- **--sort-reverse**

  **Reverse files in the output.**

- **--threshold INT**

  **Only list files with coverage \< INT %. (default: 101)**

- **--failure-threshold \[INT\]**

  **Fail if the coverage is below the threshold** **(default: 100)**

- **--charset CHARSET**

  **Charset used in Content-Type declaration of HTML reports.**

- **--only-uncovered**

  **Same as --threshold 100**

- **--replace-progname**

  **Replace $0 when loading the .rb files.**

- **-w**

  **Turn warnings on (like ruby).**

- **--no-rcovrt**

  **Do not use the optimized C runtime. (will run 30-300 times slower)**

- **--diff-cmd PROGNAME**

  **Use PROGNAME for --text-coverage-diff. (default: diff)**

- **-h, --help**

  **Show extended help message**

- **--report-cov-bug SELECTOR**

  **Report coverage analysis bug for the method specified by SELECTOR** **(format: Foo::Bar#method, A::B.method)**

- **--version**

  **Show version**

## EXAMPLES

**To simply run rcov on all ruby files in the current directory and create a** **HTML coverage report in ./coverage:**

**rcov \*.rb**

**To run the tests in ./tests, include ./lib, only take care of code executed** **from TestCases and output a summary to STDOUT:**

**rcov --test-unit-only -t -I./lib ./tests/\*.rb**

## SEE ALSO

**runit(1), [rake(1)](/rake/1.md), [rant(1)](/rant/1.md)**

**http://github.com/relevance/rcov**

**Full Documentation about the integration into other tools is available in** **/usr/share/doc/rcov/README.\***

## AUTHOR

**The manpage is provided by Micah Anderson \<micah@debian.org\> as part of the** **Debian's rcov package. Upstream author of rcov is Mauricio Fernandez \<mfp@acm.org\>.**

**All the option descriptions have mainly be taken from the help output of rcov.**
