Agree with what Oscar says below

An environment variable is an easy way to pass the settings on the fly 
since a lot of CI systems have the ability to do that.

I'd still use your launch_browser method, but inside it use a case 
statement for the browser and then you can have appropriate profiles, 
switches, etc for each browser defined

On Wednesday, April 18, 2012 11:07:08 AM UTC-7, Oscar.Rieken wrote:
>
> That won't work as easily as that because not all browsers take :switches 
>
> It will fail when you try to run the browser as anything other than chrome 
> also in order to run it for the different browsers you would need to edit 
> the fire probably better to set up an environment variable so you can pass 
> the browser thru the command line when the script is executed 
>
> Sent from my iPhone
>
> On Apr 18, 2012, at 1:50 PM, iherebyresign <[email protected]> 
> wrote:
>
> > Hi,
> > 
> > I'm looking for a way to use a single ruby script to execute all of my
> > test script within three browsers (chrome/ff/ie).  One script, say
> > main.rb, has the following code:
> > 
> > def launch_browser (browser)
> > if browser == :chrome
> > @b = Watir::Browser.new :chrome, :switches = > ["==ignore-certificate-
> > errors"]
> > else
> > @b = Watir::Browser.new browser
> > end
> > end
> > 
> > All other scripts require this script.  test.rb has the following
> > code:
> > 
> > launch_browser (:chrome) #or :ie, :ff
> > 
> > A final script that executes my entire collection, run_all.rb,
> > contains the following code:
> > 
> > require "test.rb"
> > require "test2.rb"
> > require "test3.rb"
> > etc
> > 
> > My goal is to be able to pass the browser variable using run_all.rb so
> > i can execute all test scripts on all three browsers.  I know this is
> > possible, just need to be pointed in the right direction.
> > 
> > Thanks
> > 
> > -- 
> > 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]
>
>

-- 
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]

Reply via email to