[rspec-users] Reuse of Cucumber Features
Wesley.Williams at sabre.com
Thu Apr 9 09:42:48 EDT 2009
I have similar concerns. I am coming from a background in Fit/FitNesse
so I am use to the table idea but I am not completely convinced it is
better. I really appreciate all the feedback I am getting though, great
community. I bought 'The Rspec Book' which is what got me started
looking at the tool. More chapters please. J
I do think being able to use multiple scenarios together would be nice
but I do see the issues and danger and dangers of allowing scenario
dependencies. Like all dependencies they make change hard.
Thanks again for all the feedback and assistance.
From: rspec-users-bounces at rubyforge.org
[mailto:rspec-users-bounces at rubyforge.org] On Behalf Of Rick DeNatale
Sent: Thursday, April 09, 2009 3:19 PM
Subject: Re: [rspec-users] Reuse of Cucumber Features
On Thu, Apr 9, 2009 at 3:57 AM, Matt Wynne <matt at mattwynne.net> wrote:
Another way to remove duplication (and noise) from Cucumber steps is the
hide the details in the Ruby code that implements the step, and write a
much more general step in the feature file like this:
Given there are 3 flights departing on the same day
And the flights all leave at different times
And there is another flight leaving on the following day
When the earliest flight is delayed by 5 mins
Then the flights on the first day should all be delayed by 5
And the flight on the second day should be unaffected
These kind of steps can be clearer to read, but the trade-off is that
your underlying step code gets more complex as you start writing logic
to deliver these specific scenarios. Still, if you're clever about it,
these 'declarative' steps can still be pretty re-usable.
I've gone down a similar road before, albeit with the old story runner
rather than Cucumber, and I'm not sure how far I'd push it.
That trade-off starts to get onerous. You spend a lot of time debugging
your steps to convince yourself that "the flight on the second day" maps
to "another flight leaving on the following day" when you reuse the
steps in other cases. I found myself wanting to do meta bdd on my story
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rspec-users