Sinatra 测试框架
测试 Sinatra Web 服务有哪些选项? RSpec 仍然理想吗?黄瓜?目前流行的 Sinatra 测试工具有哪些?
What are some options for testing Sinatra web services? Is RSpec still ideal? Cucumber? What are some of the current popular tools for testing Sinatra?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这取决于您的项目的需求。通常我认为我会倾向于使用 RSpec 来测试 Web 服务,但我最近有一个项目,我们使用 Cucumber 代替。我认为 Cucumber 对我们来说是正确的选择,原因有几个。
首先,我们希望验收测试能够被广泛的团队角色所接受。实际上,我们能够让业务分析师编写我们的功能和场景的初稿,这确实为开发人员提供了良好的开端。
其次,我们需要测试的部分内容是用户难以处理的工件(电子邮件)。因此,对于我们正在测试的系统的端到端部分,经典的面向 UI 的 Cucumber 非常适合。
我已经用 Cucumber 在单元级别上尝试过驱动 TDD。我发现我更喜欢 Rspec:Cucumber 不像 Rspec 或其他单元级框架那么灵活。
所以我认为这有点取决于规模、范围和参与者。
It depends on the needs of your project. Ordinarily I think I would lean toward RSpec for testing web services, but I recently had a project where we used cucumber instead. I feel that Cucumber was the right choice for us for a couple of reasons.
First, we wanted acceptance tests which would be approachable by a wide range of team roles. We were actually able to get our business analysts to write the first draft of our features and scenarios, which really gave the developers a nice head start.
Secondly, part of what we needed to test were user-intractable artifacts (emails). So for that part of the end-to-end part of the system we were testing, classic UI-oriented cucumber was a great fit.
I've done some playing around with driving TDD at the unit level with Cucumber. I find that I prefer Rspec for that: Cucumber isn't as flexible as Rspec or other unit-level frameworks.
So I think it kinda depends on the scale, scope and the participants.