It's by design
> It would be much more
> convenient for it to be follow the order of the tags.
>
Not necessarily. Sometimes hooks depend on each other, in which case
changing their execution order would break that dependency.
Why do you need to control the order from gherkin?
Aslak
> --
> 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.
>
>
I understand what you are doing, but it doesn't make much sense to me :-)
Your "pattern" is essentially replacing the core concept steps+step
definitions with tags+hooks. This is stretching tags too far, and I
don't understand what you hope to achieve by that. Have you tried the
more conventional style:
Scenario:
Given a logged in user
And an active product
Given /a logged in user/ do
@account = Factory(:account)
@member = Factory(:member, :account => @account)
log_in_member_to_account(@account)
end
Given /an active product/
Product = Factory(:product, :account => @account)
end
This is how everybody else uses Cucumber. Bonus points: Your features
are readable, and you're in control of the execution order.
> I was expecting how the tags get listed
> in the scenario to determine the order the tags get run.
>
The docs are clear that this is not the case:
https://github.com/cucumber/cucumber/wiki/Hooks
> Also, on a related note, when an error happens in a hook we get a
> scenario failure but without any helpful output as to what went wrong.
> Is there a way to change that?
>
I believe that's an old bug. It should be in the tracker somewhere -
maybe you'll find some details there. Patches are welcome.
Aslak
> Thanks for the prompt response!
>
> Jonathan.
>
I agree with Aslak, but if you do want to carry on and try to make this pattern work, I'd suggest putting your instance variables behind memoizing getter methods, so that the dependencies are more robust, and the order the hooks run doesn't matter:
module MyWorld
def account
@account ||= Factory(:account)
end
def member
@member ||= Factory(:member, :account => account)
end
end
Before '@logged_in_member' do
member
log_in_member_to_account(account)
end
>
>> I was expecting how the tags get listed
>> in the scenario to determine the order the tags get run.
>>
>
> The docs are clear that this is not the case:
> https://github.com/cucumber/cucumber/wiki/Hooks
>
>> Also, on a related note, when an error happens in a hook we get a
>> scenario failure but without any helpful output as to what went wrong.
>> Is there a way to change that?
>>
>
> I believe that's an old bug. It should be in the tracker somewhere -
> maybe you'll find some details there. Patches are welcome.
>
> Aslak
>
>> Thanks for the prompt response!
>>
>> Jonathan.
>>
>> --
>> 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.
>>
>>
>
> --
> 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.
>
cheers,
Matt
--
Freelance programmer & coach
Author, http://pragprog.com/book/hwcuc/the-cucumber-book (with Aslak Hellesøy)
Founder, http://relishapp.com
+44(0)7974430184 | http://twitter.com/mattwynne