Selenium Grid allows maintaining a cluster of Selenium RC servers, configuring tests for different environments, and parallelizing tests. It works by having a Grid Hub that manages Selenium Grid Nodes, which each run a Selenium RC Server. The Hub maps environment names like "linux_firefox_3_6" to specific browsers, and clients connect using environment names. This allows the Hub to route clients to available Nodes matching the requested environment.
Client Connection
• Clientconnects with environment name as
browser string
• Hub looks up by environment & reserves a
node
• Blocks until one is available
• Client communicates with hub at all times
• Hub forwards traffic to correct node
Makes Testing Simpler
•Client always connects to known
endpoint
• Hub takes care of browser allocation
• Nodes can be added dynamically
• Hub handles bad nodes
16.
Grid Resiliency
• Hubcan send heartbeat requests to node to
tell if it has gone down
• Hub can gracefully kill idle sessions
• Hub can kill sessions that take too long to
create
17.
Parallel Testing
• Needa way to execute in parallel
• Java: TestNG or parallel-jUnit
• Ruby: DeepTest
• Python: nose
• Need a way to parameterize your tests for
each node’s environment
• Your tests must maintain their own state
18.
Shortcomings
• Selenium 1API compatible only
• Using an old version of Selenium RC at that
• 1 request per RC
• Doesn’t scale vertically very well
• Historically has had multi-threaded problems
• Fixed as of 1.0.8
19.
Selenium Grid’s Future
•Combine Selenium Grid & RC
• De facto single-node grid
• Grid available out of the box
• Auto-discovery of other nodes on network
20.
Selenium Grid 2.0
•Proposal on dev list for new grid 2.0
• Project rewrite by François Reynaud
• Supports Selenium 1 & 2 APIs
• Nicer Web interface
• Very extensible with callback points &
listeners
21.
Selenium Grid 2.0
Listeners
• Possible uses
• Priority queue for test execution
• Stat tracking
• OS environment preparation
22.
Conclusion
• Selenium Gridis alive and well
• 4 releases in the last 9 months
• Pushing towards a Selenium 2
compatible grid
• If you have time, please review the
proposed new grid code
#15 When running headless on *nix you’ll want to set the display value. Xvfb is a great way to do this.\n\nWhen running headless on Windows you’ll want to set up VNC so the window session remains active (RDP won’t work).\n\nThe HOST value must be a routable host from the hub’s point of view. Unless you’re running the hub and the node on the same machine, this value should not be “localhost.”\n\nThe hub URL must not end in a “/”, otherwise the node will fail to register. Yes, this is not a proper URL.\n
#25 Since Selenium RC Server works over HTTP, you could maintain your own list of known servers and parameterize your tests accordingly, but grid affords additional benefits.\n