[rspec-users] could one scenario depend on another in cucumber?

Pau Cor lists at ruby-forum.com
Wed Nov 26 04:41:38 EST 2008


Newman Huang wrote:
> I think it is a common test case you would meet. For example, you want
> to test a user registry scenario. You write:
> 
> Scenario: User Registry
>    When I dosth
>    Then I dosth
>    ...
> 
> And now business has some changes. Register should have to activate his
> account by a secret code sent by mobile phone. So you need to write the
> other scenario:
> 
> Scenario: User Registry and Account Activation By Mobile
>    When I dosth
>    Then I dosth
>    ...
>    #above is the samed as User Registry scenario
> 
>    Then I visit "my setting" page
>    And I fill in "activate code" with "code"
>    ...
> 
> Because the second scenario is based on the first one, cucumber can do
> the things like:
> 
> Scenario: User Registry and Account Activation By Mobile
>    depend on [Scenario: User Registry]
> 

yes, try this:

Scenario: User Registry and Account Activation By Mobile
  GivenScenario: User Registry
  Then I visit "my setting" page
  And I fill in "activate code" with "code"
  ...

HTH
Paul
-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list