Not to mention your "given I'm an active user" is now going to happen before EVERY scenario. That's ugly. Every scenario isn't necessarily going to need that information.
This is a really surprising limitation in cucumber functionality, to my mind. Abe On Friday, May 18, 2012 12:22:17 PM UTC-7, Abe Heward wrote: > > Thanks for the post. > > You're using tags, which, again, is my primary complaint. > > But I guess that's the direction I'm going to have to go in, if we're > going to use Cucumber. > > On Friday, May 18, 2012 12:11:03 PM UTC-7, Oscar.Rieken wrote: >> >> quick example but you may get the idea you can have a step that accepts a >> url and hands it to your browser and you can have a hook that always goes >> to a certain place by default >> >> hooks.rb >> Before do >> @browser = Watir::Browser.new :chrome >> end >> >> Before("@main_site") do >> @browser.goto "www.somesite.com" >> end >> >> some.feature >> >> Background: Given I am an active user >> >> @main_site >> Scenario: go log into some site >> When I try to log in with a valid password >> Then I should see my dashboard >> >> @main_site >> Scenario: go log into some site >> When I try to log in with an invalid password >> Then I should not see my dashboard >> >> >> some_other.feature >> >> Given I am on "someother.com" >> When I try to look do something >> Then I should be able to >> >> >> >> or you can do something like pulling urls from a fixture >> @browser.goto :main_site >> >> @browser.goto :other_site >> >> >> and have different steps depending on what page you need to go to >> >> On Fri, May 18, 2012 at 2:31 PM, Abe Heward <ahew...@rsmart.com> wrote: >> >>> I can't imagine I'm the only person to run into this issue, so maybe >>> someone has an easy answer for me. I'm posting this rant/venting here >>> because I'd like the perspective of Cucumber users who also use >>> Watir/Watir-webdriver, like me. >>> >>> Cucumber has "Before" and "Background", but these happen either before >>> ALL scenarios or before EVERY scenario. >>> >>> Why this annoying limitation? >>> >>> I want an option to have something happen before the first scenario in a >>> feature. >>> >>> Use case: >>> >>> I want to test the features on a web page, but I first need to navigate >>> to that web page. I don't need to navigate to that web page EVERY TIME for >>> every scenario tested in the feature. And I ALSO don't need to navigate to >>> that page before every other feature. So, "Background" becomes utterly >>> worthless to me. >>> >>> It seems like the only answer is tagging things, but aside from being >>> ugly, it's not as useful as it should be--for example, say I want to >>> declare some variables for a feature that will be used in multiple >>> scenarios. Suddenly I have to put multiple "Before" clauses in my step >>> definitions, with various tags associated with each of them. >>> >>> Ugly. Annoying. >>> >>> Now, admittedly, I'm a total Cucumber n00b, so there's every possibility >>> that I've missed something important, here. >>> >>> Please, someone tell me that I'm just suffering from ignorance and need >>> to be schooled. >>> >>> Please. >>> >>> Abe >>> >>> -- >>> Before posting, please read http://watir.com/support. In short: search >>> before you ask, be nice. >>> >>> watir-general@googlegroups.com >>> http://groups.google.com/group/watir-general >>> watir-general+unsubscr...@googlegroups.com >>> >> >> -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com