Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding out rails' test coverage

I've just seen this issue on rails' issue tracker:

https://github.com/rails/rails/issues/2667

And I'd like to find out which parts of the code aren't covered. I couldn't find a coverage tool into the Rakefiles, and searching for it is a bit frustrating, since it returns far more results about test coverage on your rails app than test coverage of the framework itself.

Has anybody set up a code coverage tool? Is there any documentation on how to do it?

like image 353
Thiago Avatar asked Aug 24 '11 03:08

Thiago


People also ask

How do you calculate test coverage?

How to Calculate Test Coverage. Calculating test coverage is actually fairly easy. You can simply take the number of lines that are covered by a test (any kind of test, across your whole testing strategy) and divide by the total number of lines in your application.

How do I check code coverage in Ruby?

With RubyMine, you can measure how much of your code is covered with tests using the SimpleCov analysis tool. You can run tests with coverage for any supported testing framework, analyze the percentage of covered files and lines in a separate tool window and editor, generate HTML reports, and so on.

What is the tool used for to check test coverage?

TestMonitor. TestMonitor is an efficient tool for creating a visual appeal on the Test Coverage progression in the test management process and testing lifecycle. It is a well-known tool for its minimalism and perceptive move towards the test execution activities.


1 Answers

Rcov (or SimpleCov for 1.9) is the standard tool for Ruby code coverage. It should be fairly straightforward to get one of these to run the rails tests.

like image 53
Michael Fairley Avatar answered Sep 20 '22 21:09

Michael Fairley