SlideShare a Scribd company logo
1 of 25
WatirGrid
Parallel testing with Watir
About
In 2007, WatirGrid was created by Dane Avilla (brilliant!)

In 2009, I packaged it as a gem , gave it a domain
watirgid.com and have since maintained it …

    Tim Koopmans
    @90kts




               taking the FUD out of performance and test automation...
If Watir is …
WatirGrid is …
WatirGrid
Takes all the advantages of Watir …


                    //todo



And multiplies its use in a distributed,
parallel and coordinated fashion…
In other words “1 test case, many browsers”
WatirGrid is Distributed
Built with standard DRb packages.
Completely written in Ruby using core
libraries.
Lets you control Watir objects remotely with
transmission passed by reference.

 I, [2011-03-24 13:45:06 #1057] INFO -- :
   DRb server started on : druby://192.168.1.6:50600
 I, [2011-03-24 13:45:06 #1057] INFO -- :
   Ring server started on: druby://192.168.1.6:7647
WatirGrid is Parallel
WatirGrid uses Threads to execute Watir test
cases in parallel (sort of). Threads execute on
remote Watir objects, offloading any
processing overheads …

  threads = []
    grid.browsers.each_with_index do |browser, index|
     threads << Thread.new do
       ...
     end
    end
  threads.each {|thread| thread.join}
WatirGrid is Coordinated
    Based on Rinda, the Ruby version of Linda
    …
    Linda is a model of coordination and communication
    among several parallel processes operating upon objects
    stored in and retrieved from shared, virtual, associative
    memory. [1]


[1] Markoff, John (January 19, 1992). "David Gelernter's Romance With Linda". The New York Times.
WatirGrid is Free
   Uses the BSD license[1]


[1] https://github.com/90kts/watirgrid/raw/master/LICENSE
Key Terminology
Controllers implements a repository of tuples (tuple
space) that can be accessed concurrently. The controller
hosts the ring server which advertises these tuples across
a grid network. Typically you will host one controller on a
central machine.

Providers make remote Watir objects available to the
tuple space hosted by the ring server. Typically you will
host one or many providers on your grid network, for
example, each PC may become a single provider of a
Watir tuple in the form of an Internet Explorer, Firefox or
Safari browser object.
Controller + Providers
= the Grid




A loosely coupled, distributed workforce …
A Canned Example # 1
If you haven‟t already …
  gem install watirgrid


Something simple …
  require 'watirgrid'

  # Start a Controller
  controller = Controller.new
  controller.start

  # Start a Provider with SafariWatir
  provider = Provider.new(:browser_type => 'safari')
  provider.start

  # Create a Grid
  grid = Watir::Grid.new
  grid.start(:take_all => true)
What Just Happened?
Started a Controller
  DRb server was started on a random port
  A Rinda Ring Server was started on port 7647
  INFO -- : DRb server started on : druby://192.168.1.6:51163
  INFO -- : Ring server started on: druby://192.168.1.6:7647

Started 1 Provider (using SafariWatir)
  DRb server started on a random port
  The Ring Server was found on port 7647
  A browser “tuple” was registed on the Ring Server
    INFO -- : DRb server started on : druby://192.168.1.6:51164
    INFO -- : Ring server found on : druby://192.168.1.6:7647
    INFO -- : New tuple registered : druby://192.168.1.6:7647
What Just Happened?
Created a Grid
  We can see the previously registered tuple
  represented as a hash. We‟ll be using the „front
  object‟ provided …
  >> pp grid.browsers.first
  {:uuid=>"235fa1f0-37fd-012e-5bac-78ca394083a0",
   :browser_type=>"safari",
   :class=>:WatirProvider,
   :hostname=>"air.local",
   :object=>#<Watir::Provider:0x10166a240 @browser=Watir::Safari>,
   :name=>:WatirGrid,
   :architecture=>"universal-darwin10.0",
   :description=>"A watir provider"}
Let‟s Use the Grid!
Take the first (and only) browser on the grid
and execute some Watir …
# Take the first browser on the grid and execute some Watir
b = grid.browsers.first[:object].new_browser
b.goto "http://altentee.com"
b.close
A Canned Example # 2
Let‟s try with 2 providers …
  require 'watirgrid'

  # Start a Controller using defaults
  controller = Controller.new
  controller.start

  # Start 2 Providers with WebDriver
  2.times do
   provider = Provider.new(:browser_type => 'webdriver')
   provider.start
  End

  # Start another Grid
  grid = Watir::Grid.new
  grid.start(:take_all => true)
Let‟s Use the Grid!
Take all browsers on the grid in parallel using
Threads …
browser_types = [:firefox, :chrome]

threads = []
 grid.browsers.each_with_index do |browser, index|
   threads << Thread.new do
    b = browser[:object].new_browser(browser_types[index])
    b.goto "http://altentee.com"
    sleep 5
    b.close
   end
 end
threads.each {|thread| thread.join}
Let‟s all Try .. 1
I‟ll start a new Controller on port 12358
  require 'watirgrid'

  # Start a Controller on port 12358
  controller = Controller.new(:ring_server_port => 12358)
  controller.start
Let‟s all Try .. 2
You start a Provider and register on my
Controller
  require 'watirgrid'

  provider = Provider.new(
   browser_type => ‟firefox', # or ie, safari ...
   :ring_server_port => 12358)
  provider.start
Let‟s all Try .. 3!
See if I can control the grid …
  require 'watirgrid'

  # Start another Grid
  grid = Watir::Grid.new
  grid.start(:take_all => true)

  threads = []
    grid.browsers.each do |browser|
     threads << Thread.new do
       b = browser[:object].new_browser
       b.goto("http://www.google.com")
       b.text_field(:name, 'q').set("watirgrid")
       b.button(:name, "btnI").click
       b.close
     end
    end
  threads.each {|thread| thread.join}
Security Considerations
$SAFE = 1
- poor man‟s paranoia
- on latest branch


ACLs
# Start a Controller with Access Control Lists
controller -a deny,all,allow,127.0.0.1 -H 127.0.0.1 -h 127.0.0.1




HTTPS
- not yet implemented
Performance
           Considerations
Yes, but does it scale? 50..n

Ruby threads 1.8 vs. native threads 1.9, truly parallel?

Garbage collection cleaning up referenced objects!

Memory footprint of Controller? 100 Providers = 20MB
What‟$ Next?
GRIDinit.com => a commercial
implementation of WatirGrid on
different cloud providers.

Private alpha April – May,
Public beta June

support@gridinit.com
to participate …
Questions?
  About WatirGrid that is …

More Related Content

What's hot

How to scale and deploy NodeJS app
How to scale and deploy NodeJS appHow to scale and deploy NodeJS app
How to scale and deploy NodeJS app
Yacobus Reinhart
 
node.js, javascript and the future
node.js, javascript and the futurenode.js, javascript and the future
node.js, javascript and the future
Jeff Miccolis
 

What's hot (20)

Dockercon Swarm Updated
Dockercon Swarm UpdatedDockercon Swarm Updated
Dockercon Swarm Updated
 
Kubernetes networking - basics
Kubernetes networking - basicsKubernetes networking - basics
Kubernetes networking - basics
 
Philly Tech Week Introduction to NodeJS
Philly Tech Week Introduction to NodeJSPhilly Tech Week Introduction to NodeJS
Philly Tech Week Introduction to NodeJS
 
distributed tracing in 5 minutes
distributed tracing in 5 minutesdistributed tracing in 5 minutes
distributed tracing in 5 minutes
 
Docker Insight
Docker InsightDocker Insight
Docker Insight
 
How to scale and deploy NodeJS app
How to scale and deploy NodeJS appHow to scale and deploy NodeJS app
How to scale and deploy NodeJS app
 
Puppet - Instant Data Center
Puppet  - Instant Data CenterPuppet  - Instant Data Center
Puppet - Instant Data Center
 
Vert.X: Microservices Were Never So Easy (Clement Escoffier)
Vert.X: Microservices Were Never So Easy (Clement Escoffier)Vert.X: Microservices Were Never So Easy (Clement Escoffier)
Vert.X: Microservices Were Never So Easy (Clement Escoffier)
 
Couch to open_stack_keystone
Couch to open_stack_keystoneCouch to open_stack_keystone
Couch to open_stack_keystone
 
A language for the Internet: Why JavaScript and Node.js is right for Internet...
A language for the Internet: Why JavaScript and Node.js is right for Internet...A language for the Internet: Why JavaScript and Node.js is right for Internet...
A language for the Internet: Why JavaScript and Node.js is right for Internet...
 
Create your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and PackerCreate your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and Packer
 
Caching Up and Down the Stack
Caching Up and Down the StackCaching Up and Down the Stack
Caching Up and Down the Stack
 
Couch to OpenStack: Neutron (Quantum) - August 13, 2013 Featuring Sean Winn
Couch to OpenStack: Neutron (Quantum) - August 13, 2013 Featuring Sean WinnCouch to OpenStack: Neutron (Quantum) - August 13, 2013 Featuring Sean Winn
Couch to OpenStack: Neutron (Quantum) - August 13, 2013 Featuring Sean Winn
 
Csp and http headers
Csp and http headersCsp and http headers
Csp and http headers
 
The Docker Multitenancy Problem: A Journey through Infrastructure Hell
The Docker Multitenancy Problem: A Journey through Infrastructure HellThe Docker Multitenancy Problem: A Journey through Infrastructure Hell
The Docker Multitenancy Problem: A Journey through Infrastructure Hell
 
node.js, javascript and the future
node.js, javascript and the futurenode.js, javascript and the future
node.js, javascript and the future
 
C* Summit EU 2013: Cassandra Internals
C* Summit EU 2013: Cassandra Internals C* Summit EU 2013: Cassandra Internals
C* Summit EU 2013: Cassandra Internals
 
Understanding OpenStack Deployments - PuppetConf 2014
Understanding OpenStack Deployments - PuppetConf 2014Understanding OpenStack Deployments - PuppetConf 2014
Understanding OpenStack Deployments - PuppetConf 2014
 
Couch to OpenStack: Glance - July, 23, 2013
Couch to OpenStack: Glance - July, 23, 2013Couch to OpenStack: Glance - July, 23, 2013
Couch to OpenStack: Glance - July, 23, 2013
 
OWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA TestersOWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA Testers
 

Similar to WatirGrid

Apache Wizardry - Ohio Linux 2011
Apache Wizardry - Ohio Linux 2011Apache Wizardry - Ohio Linux 2011
Apache Wizardry - Ohio Linux 2011
Rich Bowen
 

Similar to WatirGrid (20)

[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
[Devconf.cz][2017] Understanding OpenShift Security Context Constraints[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
 
Swarm mode
Swarm modeSwarm mode
Swarm mode
 
Docker Swarm Introduction
Docker Swarm IntroductionDocker Swarm Introduction
Docker Swarm Introduction
 
Docker Multi Host Networking, Rachit Arora, IBM
Docker Multi Host Networking, Rachit Arora, IBMDocker Multi Host Networking, Rachit Arora, IBM
Docker Multi Host Networking, Rachit Arora, IBM
 
Dockerizing the Hard Services: Neutron and Nova
Dockerizing the Hard Services: Neutron and NovaDockerizing the Hard Services: Neutron and Nova
Dockerizing the Hard Services: Neutron and Nova
 
Apache Wizardry - Ohio Linux 2011
Apache Wizardry - Ohio Linux 2011Apache Wizardry - Ohio Linux 2011
Apache Wizardry - Ohio Linux 2011
 
Docker Networking : 0 to 60mph slides
Docker Networking : 0 to 60mph slidesDocker Networking : 0 to 60mph slides
Docker Networking : 0 to 60mph slides
 
DockerCon EU 2018 Workshop: Container Networking for Swarm and Kubernetes in ...
DockerCon EU 2018 Workshop: Container Networking for Swarm and Kubernetes in ...DockerCon EU 2018 Workshop: Container Networking for Swarm and Kubernetes in ...
DockerCon EU 2018 Workshop: Container Networking for Swarm and Kubernetes in ...
 
Big Data Step-by-Step: Infrastructure 3/3: Taking it to the cloud... easily.....
Big Data Step-by-Step: Infrastructure 3/3: Taking it to the cloud... easily.....Big Data Step-by-Step: Infrastructure 3/3: Taking it to the cloud... easily.....
Big Data Step-by-Step: Infrastructure 3/3: Taking it to the cloud... easily.....
 
Managing multicast/igmp stream on Docker
Managing multicast/igmp stream on DockerManaging multicast/igmp stream on Docker
Managing multicast/igmp stream on Docker
 
Crikeycon 2019 Velociraptor Workshop
Crikeycon 2019 Velociraptor WorkshopCrikeycon 2019 Velociraptor Workshop
Crikeycon 2019 Velociraptor Workshop
 
ДМИТРО БУДИМ «Mobile Automation Infrastructure from scratch» Online QADay 202...
ДМИТРО БУДИМ «Mobile Automation Infrastructure from scratch» Online QADay 202...ДМИТРО БУДИМ «Mobile Automation Infrastructure from scratch» Online QADay 202...
ДМИТРО БУДИМ «Mobile Automation Infrastructure from scratch» Online QADay 202...
 
Docker meetup
Docker meetupDocker meetup
Docker meetup
 
Islands: Puppet at Bulletproof Networks
Islands: Puppet at Bulletproof NetworksIslands: Puppet at Bulletproof Networks
Islands: Puppet at Bulletproof Networks
 
Rootless Containers & Unresolved issues
Rootless Containers & Unresolved issuesRootless Containers & Unresolved issues
Rootless Containers & Unresolved issues
 
Consuming Cinder from Docker
Consuming Cinder from DockerConsuming Cinder from Docker
Consuming Cinder from Docker
 
Demystfying container-networking
Demystfying container-networkingDemystfying container-networking
Demystfying container-networking
 
Clustering Docker with Docker Swarm on openSUSE
Clustering Docker with Docker Swarm on openSUSEClustering Docker with Docker Swarm on openSUSE
Clustering Docker with Docker Swarm on openSUSE
 
Collabnix Online Webinar - Demystifying Docker & Kubernetes Networking by Bal...
Collabnix Online Webinar - Demystifying Docker & Kubernetes Networking by Bal...Collabnix Online Webinar - Demystifying Docker & Kubernetes Networking by Bal...
Collabnix Online Webinar - Demystifying Docker & Kubernetes Networking by Bal...
 
Docker Security
Docker SecurityDocker Security
Docker Security
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 

WatirGrid

  • 2. About In 2007, WatirGrid was created by Dane Avilla (brilliant!) In 2009, I packaged it as a gem , gave it a domain watirgid.com and have since maintained it … Tim Koopmans @90kts taking the FUD out of performance and test automation...
  • 5. WatirGrid Takes all the advantages of Watir … //todo And multiplies its use in a distributed, parallel and coordinated fashion… In other words “1 test case, many browsers”
  • 6. WatirGrid is Distributed Built with standard DRb packages. Completely written in Ruby using core libraries. Lets you control Watir objects remotely with transmission passed by reference. I, [2011-03-24 13:45:06 #1057] INFO -- : DRb server started on : druby://192.168.1.6:50600 I, [2011-03-24 13:45:06 #1057] INFO -- : Ring server started on: druby://192.168.1.6:7647
  • 7. WatirGrid is Parallel WatirGrid uses Threads to execute Watir test cases in parallel (sort of). Threads execute on remote Watir objects, offloading any processing overheads … threads = [] grid.browsers.each_with_index do |browser, index| threads << Thread.new do ... end end threads.each {|thread| thread.join}
  • 8. WatirGrid is Coordinated Based on Rinda, the Ruby version of Linda … Linda is a model of coordination and communication among several parallel processes operating upon objects stored in and retrieved from shared, virtual, associative memory. [1] [1] Markoff, John (January 19, 1992). "David Gelernter's Romance With Linda". The New York Times.
  • 9. WatirGrid is Free Uses the BSD license[1] [1] https://github.com/90kts/watirgrid/raw/master/LICENSE
  • 10. Key Terminology Controllers implements a repository of tuples (tuple space) that can be accessed concurrently. The controller hosts the ring server which advertises these tuples across a grid network. Typically you will host one controller on a central machine. Providers make remote Watir objects available to the tuple space hosted by the ring server. Typically you will host one or many providers on your grid network, for example, each PC may become a single provider of a Watir tuple in the form of an Internet Explorer, Firefox or Safari browser object.
  • 12. = the Grid A loosely coupled, distributed workforce …
  • 13. A Canned Example # 1 If you haven‟t already … gem install watirgrid Something simple … require 'watirgrid' # Start a Controller controller = Controller.new controller.start # Start a Provider with SafariWatir provider = Provider.new(:browser_type => 'safari') provider.start # Create a Grid grid = Watir::Grid.new grid.start(:take_all => true)
  • 14. What Just Happened? Started a Controller DRb server was started on a random port A Rinda Ring Server was started on port 7647 INFO -- : DRb server started on : druby://192.168.1.6:51163 INFO -- : Ring server started on: druby://192.168.1.6:7647 Started 1 Provider (using SafariWatir) DRb server started on a random port The Ring Server was found on port 7647 A browser “tuple” was registed on the Ring Server INFO -- : DRb server started on : druby://192.168.1.6:51164 INFO -- : Ring server found on : druby://192.168.1.6:7647 INFO -- : New tuple registered : druby://192.168.1.6:7647
  • 15. What Just Happened? Created a Grid We can see the previously registered tuple represented as a hash. We‟ll be using the „front object‟ provided … >> pp grid.browsers.first {:uuid=>"235fa1f0-37fd-012e-5bac-78ca394083a0", :browser_type=>"safari", :class=>:WatirProvider, :hostname=>"air.local", :object=>#<Watir::Provider:0x10166a240 @browser=Watir::Safari>, :name=>:WatirGrid, :architecture=>"universal-darwin10.0", :description=>"A watir provider"}
  • 16. Let‟s Use the Grid! Take the first (and only) browser on the grid and execute some Watir … # Take the first browser on the grid and execute some Watir b = grid.browsers.first[:object].new_browser b.goto "http://altentee.com" b.close
  • 17. A Canned Example # 2 Let‟s try with 2 providers … require 'watirgrid' # Start a Controller using defaults controller = Controller.new controller.start # Start 2 Providers with WebDriver 2.times do provider = Provider.new(:browser_type => 'webdriver') provider.start End # Start another Grid grid = Watir::Grid.new grid.start(:take_all => true)
  • 18. Let‟s Use the Grid! Take all browsers on the grid in parallel using Threads … browser_types = [:firefox, :chrome] threads = [] grid.browsers.each_with_index do |browser, index| threads << Thread.new do b = browser[:object].new_browser(browser_types[index]) b.goto "http://altentee.com" sleep 5 b.close end end threads.each {|thread| thread.join}
  • 19. Let‟s all Try .. 1 I‟ll start a new Controller on port 12358 require 'watirgrid' # Start a Controller on port 12358 controller = Controller.new(:ring_server_port => 12358) controller.start
  • 20. Let‟s all Try .. 2 You start a Provider and register on my Controller require 'watirgrid' provider = Provider.new( browser_type => ‟firefox', # or ie, safari ... :ring_server_port => 12358) provider.start
  • 21. Let‟s all Try .. 3! See if I can control the grid … require 'watirgrid' # Start another Grid grid = Watir::Grid.new grid.start(:take_all => true) threads = [] grid.browsers.each do |browser| threads << Thread.new do b = browser[:object].new_browser b.goto("http://www.google.com") b.text_field(:name, 'q').set("watirgrid") b.button(:name, "btnI").click b.close end end threads.each {|thread| thread.join}
  • 22. Security Considerations $SAFE = 1 - poor man‟s paranoia - on latest branch ACLs # Start a Controller with Access Control Lists controller -a deny,all,allow,127.0.0.1 -H 127.0.0.1 -h 127.0.0.1 HTTPS - not yet implemented
  • 23. Performance Considerations Yes, but does it scale? 50..n Ruby threads 1.8 vs. native threads 1.9, truly parallel? Garbage collection cleaning up referenced objects! Memory footprint of Controller? 100 Providers = 20MB
  • 24. What‟$ Next? GRIDinit.com => a commercial implementation of WatirGrid on different cloud providers. Private alpha April – May, Public beta June support@gridinit.com to participate …
  • 25. Questions? About WatirGrid that is …

Editor's Notes

  1. The standard Ruby library ships with a package known as DRb. You will sometimes see this package referred to as dRuby. No matter what you call the package, they both mean the same thing, Distributed Ruby. DRb is an incredibly easy package to learn and use. It has the benefits of being written completely in Ruby and using core libraries. It also offers advantages such as automatic selection of object transmission (either pass by value or pass by reference), reasonable speed, and the ability to run on any operat- ing system that runs Ruby (see Figure 1-1). DRb also allows you to write applications without a defined interface, which can make for faster development time.
  2. When reviewing all of our DRb applications, you will notice, for a start, that we hardcoded IP addresses and ports into both our servers and clients. This type of tight coupling of applications can be problematic in both production and development. It can make fault tolerance difficult to code for. And what do you do if you need to start the service on a different machine that has a different IP address? We could also cre- ate and attempt to maintain complex configurations, but in the modern world of cloud computing IP addresses fluctuate every time you launch an instance. So, keep- ing those configuration files up to date would be extremely complicated and prone to error. That is certainly not an option.
  3. require &apos;watirgrid&apos;require &apos;pp&apos;# Start a Controllercontroller = Controller.newcontroller.start# Start a Provider with SafariWatirprovider = Provider.new(:browser_type =&gt; &apos;safari&apos;)provider.startgrid = Watir::Grid.newgrid.start(:take_all =&gt; true)# Look at the Gridpp grid.browsers.first# Take the first browser on the grid and execute some Watirb = grid.browsers.first[:object].new_browserb.goto &quot;http://altentee.com&quot;b.close
  4. require &apos;watirgrid&apos;# Start a Controller using defaultscontroller = Controller.newcontroller.start# Start 2 Providers with WebDriver2.times do provider = Provider.new(:browser_type =&gt; &apos;webdriver&apos;) provider.startend# Start another Gridgrid = Watir::Grid.newgrid.start(:take_all =&gt; true)browser_types = [:firefox, :chrome]threads = [] grid.browsers.each_with_index do |browser, index| threads &lt;&lt; Thread.new do b = browser[:object].new_browser(browser_types[index]) b.goto &quot;http://altentee.com&quot; sleep 5 b.close end endthreads.each {|thread| thread.join}
  5. require &apos;watirgrid&apos;# Start a Controller using defaultscontroller = Controller.newcontroller.start# Start 2 Providers with WebDriver2.times do provider = Provider.new(:browser_type =&gt; &apos;webdriver&apos;) provider.startend# Start another Gridgrid = Watir::Grid.newgrid.start(:take_all =&gt; true)browser_types = [:firefox, :chrome]threads = [] grid.browsers.each_with_index do |browser, index| threads &lt;&lt; Thread.new do b = browser[:object].new_browser(browser_types[index]) b.goto &quot;http://altentee.com&quot; sleep 5 b.close end endthreads.each {|thread| thread.join}
  6. require &apos;watirgrid&apos;# Start a Controller using defaultscontroller = Controller.newcontroller.start# Start 2 Providers with WebDriver2.times do provider = Provider.new(:browser_type =&gt; &apos;webdriver&apos;) provider.startend# Start another Gridgrid = Watir::Grid.newgrid.start(:take_all =&gt; true)browser_types = [:firefox, :chrome]threads = [] grid.browsers.each_with_index do |browser, index| threads &lt;&lt; Thread.new do b = browser[:object].new_browser(browser_types[index]) b.goto &quot;http://altentee.com&quot; sleep 5 b.close end endthreads.each {|thread| thread.join}
  7. require &apos;watirgrid&apos;# Start another Gridgrid = Watir::Grid.newgrid.start(:take_all =&gt; true)threads = [] grid.browsers.each do |browser| threads &lt;&lt; Thread.new do b = browser[:object].new_browser b.goto(&quot;http://www.google.com&quot;) b.text_field(:name, &apos;q&apos;).set(&quot;watirgrid&quot;) b.button(:name, &quot;btnI&quot;).click b.close end endthreads.each {|thread| thread.join}
  8. $SAFE=1The environment variables RUBYLIB and RUBYOPT are not processed, and the current directory is not added to the path.The command-line options -e, -i, -I, -r, -s, -S, and -x are not allowed.Can&apos;t start processes from $PATH if any directory in it is world-writable.Can&apos;t manipulate or chroot to a directory whose name is a tainted string.Can&apos;t glob tainted strings.Can&apos;t eval tainted strings.Can&apos;t load or require a file whose name is a tainted string.Can&apos;t manipulate or query the status of a file or pipe whose name is a tainted string.Can&apos;t execute a system command or exec a program from a tainted string.Can&apos;t pass trap a tainted string.ACLsThis will bind the controller to the localhost (127.0.0.1) and deny all access to the controller by default, whilst allowing access from localhost only. The ACL constructor takes an array of strings. The first string of a pair is always “allow” or “deny”, and it’s followed by the address or addresses to allow or deny access.SSLusing Rinda over SSL has one small draw- back: we lose the ability for Rinda to dynamically bind to any available port. This affects only the server code. The client still is completely unaware of where the serv- ice is and uses the RingServer to find the service’s location.
  9. The default ID converter, DRb::DRbIdConv, has one downside. If you’re not careful, referenced objects on the server can become garbage-collected and are no longer avail- able when the client tries to reference them. Although the client has a pointer to the local DRb::DRbObject it got from the server, the server itself may no longer have a pointer to the object that is referenced from the client. In that case it becomes eligible for garbage collection. One solution to this problem is to use the DRb::TimerIdConv class. A better approach to solve the garbage-collection problem lies in your architec- ture. Don’t take an object from the server and hold onto it in the client for any longer than you absolutely need to. Retrieve the object from the server, use it, and then get rid of it. If you want to make sure you have access to that same referenced object min- utes, hours, or days later, you should consider writing your own custom ID converter that stores your objects in something other than the ObjectSpace.