Cucumber will sort files according to their file name before running
them. Just give the file names names accordingly.
Relying on a specific ordering is something we strongly discourage, so
we don't provide an easier way than this to accomplish it.
Aslak
> Please advice,
> Dan
>
> --
> You received this message because you are subscribed to the Google Groups "Cukes" group.
> To post to this group, send email to cu...@googlegroups.com.
> To unsubscribe from this group, send email to cukes+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/cukes?hl=en.
>
>
Given the following features run in order
| Workflow Domain Setup Feature |
| Workflow Initiation Feature |
| Acceptance #1 Feature |
| Acceptance #2 Feature |
| Acceptance #n Feature |
Well, you get the drift. Thoughts?
FWIW YMMV,
Tim
----
Background: An open, active cart
Given that I have created a cart
Scenario: Foo
[skipped]
Scenario: Bar
[skipped]
----
Given /^that I have created a cart$/ do
if !defined?(@@carts_created)
When %(I create a new cart)
end
@@active_cart.should_not be_nil
end
In the Given step, I execute "I create a new cart" step, but only once
per Cucumber session. I use class variables to track the state between
Cucumber scenarios.
You could do a similar thing with your Setup Feature. Execute required
data setup lazily and track this fact in some class variables.
--
DK
AIM: DKroot1, Skype: DKroot
Understood that this(relying on test execution order) is not popular
as a general approach, and with good reason, generally. That said, I
am just as certain that there will be times where this could be the
most appropriate way to write complex acceptance scenarios.
I've been
toying implementing the following feature (which would be trivial to
implement but haven't yet because I get the feeling Aslak would fly
all the way out here and kick my butt!).
Given the following features run in order
| Workflow Domain Setup Feature |
| Workflow Initiation Feature |
| Acceptance #1 Feature |
| Acceptance #2 Feature |
| Acceptance #n Feature |
Well, you get the drift. Thoughts?
FWIW YMMV,
It should be possible to avoid this problem via a combination of data setup and a "lazy execution".
I'm personally not doing DB-level data setup yet (I'm relatively new to Cucumber), but I'm doing lazy execution to avoid any ordering problems.
----
Background: An open, active cart
Given that I have created a cart
Scenario: Foo
[skipped]
Scenario: Bar
[skipped]
----
Given /^that I have created a cart$/ do
if !defined?(@@carts_created)
When %(I create a new cart)
end
@@active_cart.should_not be_nil
end
Given /^that I have created a cart$/ do
if !defined?(@@carts_created)
When %(I create a new cart)
end
@@active_cart.should_not be_nil
end
Yuk! the nested step police have been alerted!!!
Where is the law against reusing step defs? :)
On 3/5/11 12:34 PM, Andrew Premdas wrote:Given /^that I have created a cart$/ do
if !defined?(@@carts_created)
When %(I create a new cart)
end
@@active_cart.should_not be_nil
end
Yuk! the nested step police have been alerted!!!
I can, of course, refactor the entire step def. into a helper method, but why? What does it buy me?
-- DK AIM: DKroot1, Skype: DKroot
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cu...@googlegroups.com.
To unsubscribe from this group, send email to cukes+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cukes?hl=en.
On 7 March 2011 19:54, Dmitriy Korobskiy <dkr...@gmail.com> wrote:
Where is the law against reusing step defs? :)
On 3/5/11 12:34 PM, Andrew Premdas wrote:Given /^that I have created a cart$/ do
if !defined?(@@carts_created)
When %(I create a new cart)
end
@@active_cart.should_not be_nil
end
Yuk! the nested step police have been alerted!!!
I am the law ;)
I can, of course, refactor the entire step def. into a helper method, but why? What does it buy me?
The ability to avoid nesting the step "Given that I created a cart" and replace the nesting with the call to create_cart. This makes your steps much cleaner