黄瓜是否需要查看规范
Is it necessary to use view spec even if I am using cucumber?
我认为黄瓜负责视图和流程。那么是否需要使用视图规范?
感谢一些解释..谢谢
Is it necessary to use view spec even if I am using cucumber?
I think cucumber takes care of the view and the flow.So is it required to use view spec?
A little explanation is appreciated..Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我更喜欢孤立地测试一切。所以我用 rspec 测试模型、控制器、助手和视图。对于隔离,我的意思是在控制器中我倾向于删除所有的 activerecord 和模型方法。
通过我的模型、控制器和视图测试,我倾向于实现完全覆盖。视图有点难。如果我想确保某些字段明确显示,或者某些状态正确表示,我喜欢视图测试。但视图测试可能非常详细,他们甚至可以测试某些元素是否具有正确的类。这取决于具体情况或观点本身,我真正测试了多少。
我使用黄瓜测试将所有内容联系在一起。 Cucumber 是我的集成测试:那里没有存根。我还使用 Cucumber 来验证视图中的 javascript。
所以,回答你的问题:我不认为视图测试和黄瓜有重叠。我使用视图测试来检查某些字段是否正确呈现。我在黄瓜中没有同样深度的东西。我使用 Cucumber 来遍历完整的堆栈(集成),并测试流程。
希望这有帮助。
I prefer to test everything in isolation. So I test the models, the controllers, the helpers and the views with rspec. With isolation I mean that in the controller I tend to stub out all activerecord and model methods.
With my model-, controller- and viewtests I tend to aim for complete coverage. Views is a bit harder. I like the view-tests if i want to make sure some fields are definitely shown, or some status is represented correctly. But view-tests could be very detailed, they could even test if certain elements have the correct classes. It depends on the situation or the view itself how much I really test.
I use cucumber tests to then tie everything together. Cucumber is my integration test: no stubbing there. I also use cucumber to verify my javascript in the view.
So, to answer your question: I do no think that view-testing and cucumber overlap. I use my view-tests to check that certain fields are rendered correctly. Something I do not in the same depth in cucumber. I use cucumber to go through the complete stack (integration), and to test the flow.
Hope this helps.
我认为,不。我通过将任何复杂性提取到视图助手中来尽可能保持视图简单,并单独进行测试。
In my opinion, no. I keep the view as simple as I can by extracting any complexity into view helpers, which I test separately.