如何将 Cucumber 融入代码测试比?
当我使用“rake stats”时,我可以知道我为 RSpec 测试编写了多少行代码。我的 RSpec 测试也会影响代码测试比。
但是我也可以在那里列出 Cucumber 步骤中的代码行吗?
此致
When I use "rake stats" I can get to know how many lines of code I have written for my RSpec tests. And my RSpec tests influences also the Code to Test Ratio.
But can I list my lines of code from the Cucumber steps there, too?
Best regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一个黄瓜步骤可以完成大量工作,我认为将其添加到代码/测试比率中实际上没有意义。它给你什么信息?如果您正在执行多个相关步骤怎么办?
Cucumber 测试是集成测试,它们不能替代控制器/单元测试,而是与它们一起完成。
您可能对黄瓜测试获得的结果代码覆盖率更感兴趣,这将是一个更有用的指标。
One cucumber step can do an awful lot of work, I don't think adding it to your code/test ratio would actually make sense. What information is it giving you? What if you are executing multiple dependent steps?
Cucumber tests are integration tests, they are not a replacement for controller/unit tests, but are to be done in conjunction with them.
You might be more interested in the resulting code coverage obtained by your cucumber tests, this will be a far more useful metric.
请参阅这篇文章。只需在 rspec.rake 文件中添加两行代码即可。
See this post. It's as simple as adding two lines of code to rspec.rake file.