On 26 Nov 2008, at 03:27, 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]
??
If you use ant to write build file, or rake task, dependency is
supported. So cucumber also can do it, right?
You need the feature known as 'Call Steps From Steps':
http://rspec.lighthouseapp.com/projects/16211/tickets/3-create-givenscenario-dependency-accross-feature-files
This basically allows you to make a magic step which calls in some or
all of the steps from the other scenario.
Also, perhaps I might humbly recommend my blog post about the subject:
http://blog.mattwynne.net/2008/11/14/dry-up-your-cucumber-steps/
Hope that helps,
Matt
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users