除了在 Rails 测试中使用 Capybara 和 RSpec 之外,Steak 还添加了什么? [英] What does Steak add beyond just using Capybara and RSpec in Rails testing?

查看:26
本文介绍了除了在 Rails 测试中使用 Capybara 和 RSpec 之外,Steak 还添加了什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图了解牛排的必要性.我知道它就像 Cucumber,除了你可以使用纯 ruby​​ 而不是像在 Cucumber 中那样将你的英语语言规范映射到 ruby​​,但它说它主要围绕 RSpec DSL 添加了一个包装器,并允许您使用它

I'm trying to understand the need for Steak. I get that its like Cucumber, except that you can use pure ruby instead of mapping your english language specs to ruby like in Cucumber, but it says that it mainly adds a wrapper around the RSpec DSL, and lets you use that

取自:http://jeffkreeftmeijer.com/2010/牛排因为黄瓜是素食主义者/

module Spec::Example::ExampleGroupMethods
  alias scenario example
  alias background before
end

module Spec::DSL::Main
  alias feature describe
end

仅此而已吗?我从示例中似乎仍然使用 Capybara 和 RSpec 匹配器进行繁重的工作.那么为什么不直接使用 Capybara 和 RSpec 而不是在它上面添加像 Steak 这样的复杂功能呢?英语接受规范描述是唯一的价值主张,还是我遗漏了其他东西?

Is that all? I seems from the examples that you still do the heavy lifting with Capybara and RSpec matchers.. So why not just use Capybara with RSpec instead of adding a complication like Steak on top of it? Are the English language acceptance spec descriptions the only value proposition, or am I missing something else?

谢谢

推荐答案

从技术上讲,Steak 只增加了三件事:

Technically speaking Steak just adds three things:

  • 一些以别名(场景、背景、功能)形式出现的语法糖,提醒开发人员他们正在编写验收规范,而不是常规规范.

  • Some syntactic sugar in the form of aliases (scenario, background, feature) which remind developers that they are writing an acceptance spec, not a regular one.

几个方便的用于 Rails 的生成器,可帮助开发人员快速设置新项目或新规范

A couple of convenient generators for Rails that help developers to quickly set up a new project or a new spec

Rake 支持单独运行验收规范等.

Rake support to run your acceptance specs in isolation, among other things.

您可以将 Steak 视为 RSpec 的最小扩展.但比技术问题更重要的是与 Steak 相关的非技术问题:

You can think of Steak as a minimal extension of RSpec. But even more important than the technical things are the non-technical things associated to Steak:

  • 它提供了一个名称,用于使用 RSpec 进行接受 BDD.说你使用 Steak 比解释你练习什么类型的测试更短.

  • It provides a name for doing acceptance BDD with RSpec. Saying that you use Steak is shorter than explaining what type of testing you practice.

它提供了一个社区(邮件列表、维基、推特帐户……),由开发人员进行这种特殊形式的测试、分享经验、问题和最佳实践.

It provides a community (mailing list, wiki, twitter account…) of developers doing this particular form of testing, sharing experiences, problems and best practices.

我不认为 Steak 会给任何熟悉 RSpec 的人增加任何复杂性,但是如果您这么认为并且您并不真正关心以前的所有事情,那么您根本不需要使用 RSpec,您可能会使用 Test::Unit + Capybara 会更快乐.

I don't think Steak adds any complication for anyone familiar with RSpec, but if you think so and you don't really care about all previous things, then you don't need to use RSpec at all, you will probably be happier using just Test::Unit + Capybara.

这篇关于除了在 Rails 测试中使用 Capybara 和 RSpec 之外,Steak 还添加了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆