[rspec-users] cucumber - referential (inherited?) scenarios
ben at benmabey.com
Sat May 2 18:33:20 EDT 2009
Julian Leviston wrote:
> Fair enough.
> The steps from step definitions one is the best approach for what I
> want, and it's actually what am doing, but I do notice that there's a
> lot of the time when I'm actually re-typing the same text (ie once in
> the explicit explanation of what it means to log in, and then once
> more in the step definitions to refer to that login procedure) when I
> do this approach. Re-typing the same stuff is pretty retarded, and
> never a good idea.
> Hence... my interest in this feature :)
> How about this... Whenever I refer to other steps from within my
> steps, they should be printed out on the output line... tabbed in a
> bit, like so:
> Given I am logged in:
> Given a default user exists
> And I am on the login page
> And I fill in "username" with "username"
> And I fill in "password" with "password"
> Then I should be on the superduper page
> Then the option to turn this feature off or on on the command line.
We would definitely want it as a feature you could turn on or off. By
default I think it should be off. I think it adds a lot of noise to the
feature output. In most cases I don't care what the exact steps of
logging in are. How I log in can change and it doesn't really effect
this scenario at all. What is important is that you are logged in- not
how you got there. So this is probably not a feature I would personally
use. (Especially, given that I don't use steps within steps a whole
lot.) That said it seems like a reasonable request... Any other
opinions on the suggested feature? Should we move the discussion to
> That'd be bloody brilliant. Okay so maybe I should go fork it and do
> it :)
> On 03/05/2009, at 4:50 AM, Ben Mabey wrote:
>> Julian Leviston wrote:
>>> You know what'd be awesome?
>>> If Cucumber scenarios were referential.
>>> I mean, wouldn't it be awesome if you could refer to them... so you
>>> could build on them...
>>> So in a login.feature I'd define:
>>> Scenario: logging in
>>> Given that a default user exists
>>> And I am on the login page
>>> When I fill in "username" with "username"
>>> And I fill in "password" with "password"
>>> Then I should be logged in
>>> And then in a different feature somewhere else, I could say:
>>> Scenario: make toast
>>> Given Scenario "logging in"
>>> Given I am on the exciting logged in page
>>> Then I .... blah blah blah
>>> and so on...
>> Believe it or not, this exact feature did exist in Cucumber at one
>> time but was deprecated and is now removed. You can find a good
>> explanation of the reasoning behind that decision and what are the
>> better alternatives on Joseph's blog:
>> rspec-users mailing list
>> rspec-users at rubyforge.org
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users