My two cents:
Aside from the global variables, what ultimately added complexity in Cucumber is the regex. When doing BDD (presumably with a client), I think the two indispensable components that we are looking for are:
-
Connextra Format/Gherkin syntax - Gherkin is the part of cucumber that deals with the
.feature
files. Based from Steve's reasons for choosing Cucumber, I suspect that it's really Gherkin that we really want. Basically, we want business analysts (spec/product/domain guy) to articulate specs without dealing with the internals of the app they want us to create. -
Step Definitions - The code that will be driven by #1 (Capybara and party). In Cucumber's case, I don't like that fact sometimes regex step defs can be a pain to use. I don't want to debug some regex everytime I create a step definition with parameters to match. Frankly, they're not readable by humans.
I think it's overkill to use regex in step defs just for the sake of DRYness and being able to accept parameters. Like what Steve said, steps don't have to be as DRY as our codebase. The right way of describing the scenarios should be in declarative way anyway. Ergo, less regex needed.
Gladly, there are already a number of available alternatives to Cucumber that may address our specific needs. Here are my first impressions of each option based on their docs/description:
-
Steak - basically this is RSpec + Capybara niceties. It throws away Gherkin. We
might
use this internally, but I'm pretty sure that for client-based work, we wouldn't. -
-
it has Gherkin. +1!
-
step definitions are just in this format (easier than regex):
module SomeSteps step "there is/are :user_count users" do |:user_count| # some ruby code here e.g. capybara end end
-
Control step scope via RSpec.configure, since steps are defined in modules. At the very least, this can easily solve step conflicts.
-
-
- it has Gherkin too!
- Based on their blog post, the guys who made this basically had the same complaint we had for Cucumber: the way steps defs are implemented in Cucumber suck.
- Step definitions for a
Feature: Some Feature
are either in that associatedSomeFeature < Spinach::FeatureSteps
class, or in theinclude
-d modules. No surprises. Less chances for conflict. - Want to encapsulate/expose certain step defs/variables/methods? Do it the Ruby way:
private
-ize methods,include
Modules. Whatever floats your boat.
Personally, I would like to try out Spinach first, simply because it was borne out of the same frustration we had for Cucumber (step definitions). This is the tool that satisfies our minimum requirements.
What do you think?
(This discussion is worthy of a tech talk, a blog post, and/or topic for the upcoming meetup.)