haml 的代码覆盖率工具?
由于 Haml 代码每行一个语句的结构,看起来很有可能获得有用的覆盖率报告。
您知道有哪些适用于 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
代码覆盖率通常确保覆盖所有代码路径。如果你认为有很多逻辑,那就是一种气味。我认为逻辑应该转移到你的帮助者、控制器(呈现不同的视图)或演示者,以及那些你可以完美覆盖测试的人。
除此之外:理论上这应该是可能的,但我不想鼓励在视图中放置太多“智能”。
Code coverage generally makes sure you cover all your code-paths. If you have a lot of logic in your view, that is a smell. I think logic should be moved to your helpers, controllers (render a different view) or presenters, and those you can test with perfect coverage.
Aside of that: theoretically it should be possible, but i would not want to encourage placing too much "intelligence" in views.
非主流语言(例如 HAML)的一个问题是工具很难找到,因为它们很难构建。
这篇技术论文Branch Coverage for Arbitrary Languages Made Easy(我是作者)描述了如何使用通用工具构建基础设施以系统的方式构建语言的测试覆盖工具来帮助解决这个问题。
One problem with non-mainstream languages (such as HAML) is that tools are hard to find, because they are hard to build.
This technical paper Branch Coverage for Arbitrary Languages Made Easy (I'm the author) describes how to build test coverage tools for langauges in systematic way to help get around this problem, using a generic tool-building infrastructure.