Hey Tim,

So I have been trying all morning (UK Time) trying to get the cucumber
scenarios divided to run in different browsers but to no avail...
I looked at your example that you provided in the stackoverflow
question and im still struggling to get this working.
The way I am running the tests is by going to the folder which
contains the cucumber feature files and then typing 'cucumber' in the
command prompt. (I didnt quite understand your comment regarding bash
files etc...)

Here is what I have:

So I have two feature files each with 2 scenarios
I have 2 step_definition files and an env.rb


My env.rb file looks something like this:
$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', '..',
'..', 'lib'))
require 'watirgrid'
require 'rspec/expectations';

ENV["GRID"] = 'true'
ENV["controller_uri"] = "druby://10.194.192.181:11235"

controller = Controller.new(
  :loglevel => Logger::ERROR)
controller.start

 2.times do
  provider = Provider.new(
    :loglevel => Logger::ERROR, :driver => 'webdriver')
  provider.start
end

if ENV["GRID"] then
  params = {}
  params[:controller]   = controller
  params[:browser_type]     = 'firefox' # type of webdriver browser to
spawn
  grid ||= Watir::Grid.new(params)
  grid.start(:initiate => true, :quantity => 2, :take_all => true)
else
  @browser ||= Watir::Browser.new :firefox
end

Before do |scenario|
  @grid = grid
  @browser = grid.providers.first
end

at_exit do
  grid.iterate do |browser|
    browser.close
  end
  grid.release_tuples
end

Not the issue that I am getting is when I try to run the two feature
files split over 2 firefox browsers.
What is happening is, both the feature files are running in both
firefox instances.
So the same tests are being run twice at the same time.

What I was hoping for was to see either, the first feature file being
split in the two browsers (one scenario each from the same feature
file being run in two browsers) OR one feature file in one browser (so
btoh the feature files are running in parallel to one another).

Is there something that I am missing? Is there some more info that can
be provided by myself.

I shall be on late today (trying to catch your reply) so hopefully I
can provide quick feedback.

Kind regards,
Usman Hussain


On Jun 4, 4:03 am, Tim Koopmans <[email protected]> wrote:
> Hi Usman,
>
> If you follow the cucumber example you can indeed run 2 or more instances of
> a webdriver browser on one machine. Line 13 in env.rb should be changed to
> n.times where n is the desired number of browsers ...
>
> But beware that running multiple browsers on a single core (machine) is not
> ideal in terms of performance. You'll probably find browser performance will
> degrade after 5 or so parallel browsers. YMMV. And yes you can start and
> stop a controller/providers programatically rather than a command line.
> There's plenty of examples in the git repo (as well as its spec test cases)
> which do this...
>
> The next question you'll probably ask is how can you then divide the
> cucumber scenarios up between the different browsers so the entire suite can
> be processed more quickly. As in run different scenarios at the same time.
> Have a look at the discussion 
> here:http://stackoverflow.com/questions/5903379/parallel-cucumber-watir-sc...
>
> Cheers,
> Tim
>
> @90kts
>
>
>
>
>
>
>
> On Sat, Jun 4, 2011 at 11:27 AM, <[email protected]> wrote:
> > Hi tim,
>
> > Thanks for your advice. I will be trying to run everything on one machine.
>
> > Also a side question which is prob really stupid, but in your examples on
> > github, do the env.) Files in the cucumber section not start the providers
> > and controllers.
> > I am using cucumber with watir webdriver. I managed to get 1 test running
> > on 2 browsers. But I was more interested in the parallel tests. So getting 2
> > feature files running in parallel to one another.
>
> > I really do appreciate your help.
>
> > Kind regards,
> > Usman
>
> > ------------------
> > ------------------------------
> > *From: * Tim Koopmans <[email protected]>
> > *Sender: * [email protected]
> > *Date: *Fri, 3 Jun 2011 22:27:13 +0000
> > *To: *<[email protected]>
> > *ReplyTo: * [email protected]
> > *Subject: *Re: [wtr-general] Watir Grid Examples Help
>
> > Hi Usman, I can probably help you =)
>
> > The correct order to start up a grid is:
> > 1. start the controller on a central machine e.g.
> > controller
>
> > when it starts up it will tell you what its URI is. This is what you'll use
> > to connect other providers e.g.
> > I, [2011-06-04 08:22:15 #99844]  INFO -- : Controller started on : *
> > druby://10.0.1.158:11235*
>
> > 2. Now on the remote machines, start up the providers e.g.
> > provider -d webdriver -c *druby://10.0.1.158:11235*
>
> > Note I need to specify a driver (-d) and the controller's URI (-c). You
> > should see something like this in the console.
> > I, [2011-06-04 08:25:37 #3069]  INFO -- : Provider started on   : druby://
> > 10.0.1.158:11236
> > I, [2011-06-04 08:25:37 #3069]  INFO -- : Controller found on   : druby://
> > 10.0.1.158:11235
> > I, [2011-06-04 08:25:37 #3069]  INFO -- : Provider registered   : druby://
> > 10.0.1.158:11235
>
> > Are you trying to run 2 browsers on one machine, or 2 browsers on 2 remote
> > machines? If you are starting multiple providers on the same machine then we
> > will need to separate their DRb servers which I can help you with ...
>
> > Cheers,
> > Tim
>
> > @90kts
>
> > On Fri, Jun 3, 2011 at 2:40 PM, Usman Hussain 
> > <[email protected]>wrote:
>
> >> Hi Guys,
>
> >> I wanted to get my tests to run parallel to one another so I went to
> >> GitHub/WatirGrid and downloaded the whole project.
>
> >> I then began to run the examples. I was able to one tests running in
> >> two different browsers (firefox and chrome).
>
> >> So then I thought let me run the parallel test provided.
>
> >> But when I do I get the following error:
>
> >> druby://10.0.1.3:11235 - #<Errno::ECONNREFUSED: Connection refused -
> >> connect(2)> (DRb::DRbConnError)
>
> >> I then went to Terminal and typed in 'controller' and got the
> >> following:
>
> >> I, [2011-06-03 15:31:40 #67916]  INFO -- : Controller started on :
> >> druby://10.194.192.181:11235
>
> >> So I changed the controller uri to druby://10.194.192.181:11235 and
> >> then i got the following error:
>
> >> druby://10.194.192.181:11235 - #<Errno::ECONNREFUSED: Connection
> >> refused - connect(2)> (DRb::DRbConnError)
>
> >> Has anyone else had any trouble running the examples in watirgrid...
> >> or come across this error message?
>
> >> Kind regards,
> >> Usman Hussain
>
> >> --
> >> Before posting, please readhttp://watir.com/support. In short: search
> >> before you ask, be nice.
>
> >> [email protected]
> >>http://groups.google.com/group/watir-general
> >> [email protected]<http://groups.google.com/group/watir-generalwatir-general+unsubscribe...>
>
> >  --
> > Before posting, please readhttp://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 readhttp://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