On Tuesday, April 9, 2013 2:11:41 AM UTC-7, [email protected] wrote: > I think I have figured out where the problem resides now I need to figure > out how to fix the problem: > > Let me explain... > > So my folder structure is as follows: > > -features > - support > - env.rb (this is the main one where I require gems and ahve the > environment settings etc...) > - functional_area_one > - step_definitions > - *.rb > - support > - env.rb (I only have one line in here which > is: Dir["features/support/env.rb"].each {|file| require file } > - *.feature > - functional_area_two > - step_definitions > - *.rb > - support > - env.rb (I only have one line in here which > is: Dir["features/support/env.rb"].each {|file| require file } > - *.features > -lib (utils and page objects sit in here) > > So I have split my feature files out into different functional areas. > therefore creating sub folders. Now because of the way cucumber is, I have > created an env.rb file for each folder. But instead of cut and pasting all > the code into multiple env.rb files, I have just re-directed it to point to > the main one where all the configuration, requiring etc... takes place. > > I think, because of this, when the env.rb file is called twice. Once > originally and then for the second time when the env.rb file points it back > to the main one. > > Therefore causing it invoke the browser twice because two calls are being > made at separate times in the set up. > > Is there a more elegant solution as to how I can layout my folders? Or > shall i add all the details into each and every env.rb file? > > kind regards, > Knoll >
As Oscar suggests, I strongly recommend reading "The Cucumber book". If these are all tests against the same site, I would not divide up the step files etc. Just group your steps by functionality, have them in a single folder. There's no reason to have a huge number of step files, it starts to make it harder to find steps when you need to work on them. Likewise a single support folder with a single env.rb and whatever other helper stuff you need. Group the features into subdirectories, think of that part as the 'story of your product' as if you were writing a book that described how the product is interacted with by users, where each directory is a chapter on a given subject.. If these are different products, then I'd have completely separate folders for each one, within which was the features folder and all below it. If you have some shared helper methods etc then maybe those go out in a /lib folder at the same level as the projects, and it gets referred to by the env.ruby stuff -- -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. [email protected] http://groups.google.com/group/watir-general [email protected] --- You received this message because you are subscribed to the Google Groups "Watir General" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
