Ruby是否存在C1代码覆盖率分析? [英] Does C1 code coverage analysis exist for Ruby?

查看:100
本文介绍了Ruby是否存在C1代码覆盖率分析?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用 Rcov 来获取我所使用的Rails项目的C0代码覆盖率分析

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

但是,这些结果实际上是毫无意义的-根据rcov的研究,我有100%的覆盖率(因为它仅涵盖C0分析),我几乎没有写过

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.

我已经习惯了Visual Studio 2008 Team的代码覆盖范围(包含C1)的有用结果。

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?

推荐答案

目前,没有针对Ruby的C1覆盖工具。实际上,除了RCov之外,没有任何覆盖工具。

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

直到最近,只能通过打补丁来编写这样的工具或大约在C语言中扩展MRI解释器。自大约两年前以来,还可以在Java中扩展JRuby,并且实际上自上个月以来就有一个用于JRuby的RCov端口。但是,这需要具备Ruby C的知识,并且还需要很深的知识,因为摆弄MRI的内部内容并不会使您心生虚弱。

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.

但是只有使用Rubinius,才有可能在Ruby本身中编写动态分析工具,例如代码覆盖率工具,从而使Ruby社区的更大一部分都可以访问该工具。我的希望是,再加上工具供应商的大量财务支持(许多主要的IDE供应商正在或已经推出了Ruby IDE,包括CodeGear(前Borland),IntelliJ,NetBeans,Eclipse,SapphireSteel(Ruby in Steel) (对于Visual Studio)甚至是Microsoft)都将在2009年带来Ruby工具领域的快速创新,我们将看到诸如C1,C2覆盖率,NPath复杂性,更细粒度的分析等内容。

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.

直到那时,我唯一的想法就是使用Java工具。 JRuby家伙试图发出适当的魔术元数据,以使其生成的字节码至少可被Java工具穿透。因此,也许可以将Java覆盖工具与JRuby一起使用。但是,我不知道这是否真的有效,或者它是否应该有效。

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.

这篇关于Ruby是否存在C1代码覆盖率分析?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆