[rspec-users] cucumber - referential (inherited?) scenarios

Lee Hambley lee.hambley at gmail.com
Sat May 2 14:33:40 EDT 2009


Hi Julian,
You can do just that, the scenarios stack like that quite well, and it is
reasonable to call a step from another, but you should  have something like

Scenario: Logging In
Given there is a user
When I visit the login page
And I fill in username with .......
And I fill in passowrd with ........
Then I should be logged in as .......

Scenario: Visiting Account Page
Given I am logged in
When I visit the account page
Then I should see my account settings

... "Given I am logged in" you define to call in turn each of the step
matchers you wrote to satisfy the first scenario.

.. does that fit your expectations / workflow?


2009/5/2 Julian Leviston <julian at leviston.net>

> 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:
>
> another.feature
>
> Scenario: make toast
> Given Scenario "logging in"
> Given I am on the exciting logged in page
> Then I .... blah blah blah
>
> and so on...
>
> Julian.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090502/1ed967b7/attachment.html>


More information about the rspec-users mailing list