Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does C1 code coverage analysis exist for Ruby? [closed]

I'm currently using Rcov to get C0 code coverage analysis for a rails project that I'm working on.

However, those results are practically meaningless- I have 100% coverage according to rcov (as it only covers C0 analysis) and I've barely written half the test cases for the functionality that exists thus far.

I'm used to the useful results from the code coverage in Visual Studio 2008 Team, which has C1 coverage. Are there any tools that provide similar coverage for ruby?

like image 940
Eliza Brock Marcum Avatar asked Nov 14 '08 05:11

Eliza Brock Marcum


2 Answers

At the moment, there are no C1 coverage tools for Ruby. In fact, there aren't any coverage tools other than RCov.

Until recently, it was only possible to write tools like this by patching or extending the MRI interpreter in C. Since approximately two years ago, it is also possible to extend JRuby in Java, and there is actually since last month a port of RCov for JRuby. However, this requires both a knowledge of Ruby and C, and a pretty deep knowledge at that, because fiddling around with the internals of MRI is not for the faint at heart.

But only with Rubinius will it be possible to write dynamic analysis tools such as code coverage tools in Ruby itself, making tool writing accessible to a much larger portion of the Ruby community. My hope is that this, coupled with the substantial financial backing of tool vendors (many major IDE vendors are either working on or have already introduced Ruby IDEs, including CodeGear (ex-Borland), IntelliJ, NetBeans, Eclipse, SapphireSteel (Ruby in Steel for Visual Studio) and even Microsoft) will lead to rapid innovation in the Ruby tooling space in 2009 and we will see things like C1, C2 coverage, NPath complexity, much more fine-grained profiling and so on.

Until then, the only idea I have is to use Java tools. The JRuby guys try to emit the proper magic metadata to make their generated bytecode at least penetrable by the Java tools. So, maybe it is possible to use Java coverage tools with JRuby. However, I have no idea whether that actually works, nor if it is supposed to work.

like image 181
Jörg W Mittag Avatar answered Oct 15 '22 21:10

Jörg W Mittag


DeepCover is the only complete C1 Ruby Coverage tool that exists today.

Disclosure: I'm co-author of DeepCover.

like image 36
Marc-André Lafortune Avatar answered Oct 15 '22 21:10

Marc-André Lafortune