What does Steak add beyond just using Capybara and RSpec in Rails testing?

99封情书 提交于 2019-11-30 18:55:48

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.

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

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

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:

  • 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.

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.

Your hunch is possibly correct and Steak further confuses the rSpec testing namespace.

The 'acceptance' directory, for example, implies you are doing acceptance testing with steak, which is rarely the case and generally the reason you use Steak over cucumber.

For a clearer definition see: http://en.wikipedia.org/wiki/Acceptance_testing

Since you are ruling out cucumber and using rSpec, which is typically not known as a DSL that stakeholders / non technical analysts read, a closer fit might be integration testing:

http://en.wikipedia.org/wiki/Integration_testing

We are phasing out steak in favor of rSpecs native 'request' and 'feature' specs, which are essentially the same thing out of the box. It might be worth checking those out.

https://www.relishapp.com/rspec/rspec-rails/docs/request-specs/request-spec https://www.relishapp.com/rspec/rspec-rails/docs/feature-specs/feature-spec

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!