黄瓜是否需要查看规范

发布于 2024-12-06 21:03:10 字数 140 浏览 1 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

穿越时光隧道 2024-12-13 21:03:10

我更喜欢孤立地测试一切。所以我用 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.

喵星人汪星人 2024-12-13 21:03:10

我认为,不。我通过将任何复杂性提取到视图助手中来尽可能保持视图简单,并单独进行测试。

In my opinion, no. I keep the view as simple as I can by extracting any complexity into view helpers, which I test separately.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文