[rspec-users] How should I interpret RCov, code coverage?
lists at ruby-forum.com
Thu Aug 25 04:14:58 EDT 2011
First of all I'm new to RCov.
I'm having a rails application with around 20 models and 20 controllers
+ helpers and others.
And I've got an unusual good RCov test coverage, 39%(total) and 31%(code
coverage) - and this with only 12 RSpec examples.
I'm running RCov with the following options:
t.rcov_opts = "--callsites --xrefs --no-comments --rails --exclude
What kind of heuristic is RCov using? I'm reading its manual
http://www.linuxcertif.com/man/1/rcov/ and it says:
> 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.
That being said, it means that:
(in my case) 31% Lines Of Code of the application logic have been
executed by the test files. E.g. if a method has been executed for one
test case than that method (the LOC that represent that method) are 100%
tested. The bad side is that if a test file loads a Class A (just by
including its name into its logic), and doesn't execute any of its
method, the methods signatures of that class will count as executed LOC
100% tested, therefore the number can grow quite easy. **Right?**
Is an RCov code coverage of 100% really good? Because in my opinion a
method should be tested for more than one case but rcov doesn't care
about this :(.
Is there another tool which does a better job on rails projects than
RCov on test coverage?
Posted via http://www.ruby-forum.com/.
More information about the rspec-users