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

后端 未结 2 2121
面向向阳花
面向向阳花 2021-01-04 23:15

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

相关标签:
2条回答
  • 2021-01-05 00:04

    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.

    0 讨论(0)
  • 2021-01-05 00:07

    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

    0 讨论(0)
提交回复
热议问题