Questions tagged [rcov]

For issues relating to the Rcov coverage tool for Ruby.

Rcov is a code coverage tool for . It is commonly used for viewing overall test coverage of target code. It features:

  • cross-referenced XHTML and several kinds of text reports
  • support for easy automation with Rake
  • colorblind-friendliness

Resources:

48 questions
11
votes
5 answers

Un-monkey patching a class/method in Ruby

I'm trying to unit test a piece of code that I've written in Ruby that calls File.open. To mock it out, I monkeypatched File.open to the following: class File def self.open(name, &block) if name.include?("retval") return "0\n" else …
Chris Bunch
  • 87,773
  • 37
  • 126
  • 127
11
votes
1 answer

Rcov coverage changes drastically with -xrefs

My current Ruby on Rails project does testing via rcov (specifically, relevance rcov, and we have a pretty high standard (we fail the build if we have < 95% code coverage). We use the following command to test this: rcov_cmd = "rcov --rails…
RyanWilcox
  • 13,890
  • 1
  • 36
  • 60
8
votes
3 answers

RCov for RSpec 2 not detecting coverage correctly? (not Rails!)

Preface I've just started getting into Ruby and try to not only learn the language but also some development strategies. As kind of a beginner I'm concentrating on Test and Behaviour Driven Development. (yes, I'm doing both for comparison…
Torbjörn
  • 5,512
  • 7
  • 46
  • 73
8
votes
1 answer

In rcov, is there a way to find which test method traversed a given line of code being tested?

In rcov, is there a way to find which test methods were tracked as having covered a given line of code (in your target code that you're testing)?
Aaron Fi
  • 10,116
  • 13
  • 66
  • 91
8
votes
4 answers

RCov with RSpec-2

I'm working with a bit of a bleeding edge rails app. Rails 3, RSpec 2, Rspec-Rails2. It seems as if RSpec2 doesn't include the spec:rcov rake task that RSpec 1 has. (at least it isn't there yet) Has anyone had any luck running rcov with rspec 2, or…
JoshReedSchramm
  • 2,751
  • 1
  • 27
  • 45
7
votes
1 answer

What's the difference between "total coverage" and "code coverage" in rcov?

When rcov generates a report, it shows "total coverage" and "code coverage" for each file. What's the difference between the two metrics?
mkelley33
  • 5,323
  • 10
  • 47
  • 71
6
votes
2 answers

How do I get code coverage stats for my Sinatra app?

I have written a Sinatra app (web site), and I would like to collect code coverage information for the site's code. I'm new to Ruby, but Google tells me that rcov is a good code coverage tool. Unfortunately, all the information I can find online…
Bruce
  • 8,202
  • 6
  • 37
  • 49
6
votes
2 answers

Code coverage tools for haml?

It looks like it's quite possible to get a useful coverage report for Haml code, due to its one one-statement-per-line structure. Do you know of any code coverage tools for Haml? Maybe something is in the works?
Leonid Shevtsov
  • 14,024
  • 9
  • 51
  • 82
6
votes
2 answers

Rcov: Why is this code not being considered covered?

Here's my controller: class MyController < ApplicationController include MyHelper def index get_list_from_params do |list| @list = list respond_to do |format| format.html format.xml { render :xml => @list } …
Craig Walker
  • 49,871
  • 54
  • 152
  • 212
5
votes
1 answer

Rcov report index file wasn't found in jenkins

I am trying to configure a rails project to jenkins. there are some test code. I am covering the test code using rcov. But when i build the project on jenkins , the following error was found. Publishing rcov report... rcov report index file wasn't…
Sazzad
  • 773
  • 11
  • 22
4
votes
1 answer

Skipping files in spec/ when running rcov with RSpec 2.5

When running rake spec:rcov for a Rails 3 application, the files in the spec/ directory are getting included in the coverage statistics, but I don't want them to be. I want coverage statistics only for my actual application. In older versions of…
Emily
  • 17,813
  • 3
  • 43
  • 47
4
votes
2 answers

rcov + Rails3 rc now broken from linecache dependency

I hit a wall today with rcov + Rails3. I am developing my Rails3 app using Ruby 1.9.2-preview3. rcov and relevance-rcov do not work with Ruby 1.9.2 yet. I can't find any fork of rcov that does yet either. It wasn't that big of a deal since I…
gdonald
  • 984
  • 2
  • 12
  • 23
4
votes
2 answers

Rails + Capybara-webkit – javascript code coverage?

I am looking into using capybara-webkit to do somewhat close-to-reality tests of app. This is absolutely neccessary as the app features a very rich JS-based UI and the Rails part is mostly API calls. The question is: is there any tools to integrate…
Anton
  • 2,483
  • 2
  • 23
  • 35
4
votes
1 answer

How does one collect rcov-style information on the processing of erb templates?

I'm using rcov on a set of tests autogenerated from my rails routes to collect information on dead code (code which is never called in the application). This set up already generates enlightening results for controllers, models, helpers, and lib…
Ben Hughes
  • 14,075
  • 1
  • 41
  • 34
3
votes
1 answer

SimpleCov not covering inside def/methods

Background: running Rails 3.2, Cucumber 1.1.4, and SimpleCov 0.5.4. We have all of our Cucumber specs passing and the code should be covered. But the strange thing is that when we check the Cucumber coverage report generated by SimpleCov, the actual…
SP.
  • 305
  • 2
  • 13
1
2 3 4