Friday, December 5, 2014

Creating machine templates for getting your Selenium Grid Running

One of the annoying things I'm finding myself doing more and more is needing to manage the machines on Selenium Grid.  Between software upgrades, machines becoming unstable, network and power outages, does an automation engineer in a small company have time to even code?

Selenium Grid Extras helps with keeping your selenium drivers up to date and nodes stable

Fortunately, there's a pretty neat open source project that adds a few maintenance extras on top of Selenium Grid.
https://github.com/groupon/Selenium-Grid-Extras

Selenium Grid Extras gives you the following

  • Rebooting nodes upon running 10 (or a configurable number of tests)
  • auto updating Selenium Server and Selenium drivers such as IEDriverServer and ChromeDriver to the latest upon each machine boot.
  • Test recording

Installing it using BoxStarter

Of course, as a small group of test engineer that needs to support multiple OS and Browsers, you'll quickly find yourself out numbered by the machines you need to manage on the day to day basis.  Wouldn't it be great to simply wipe out your VMs, and apply a install script that installs things you need and have a box ready to join the grid?  However the annoying thing is you have a fresh machine on the network, and you need to copy over installation files, deploy, and configure.

Using boxstarter, http://boxstarter.org/, you can use gists, to help accelerate you setup.  Boxstarter is a unique project in that you can use GitHubs gists to store PowerShell commands that call Chocolatey installs, https://chocolatey.org/.  Using a simple Boxstarter formula, you can automate installing all your browsers, copying over Selenium Grid Extras, and writing config files to disk so they're ready to go.

Here's a sample of how I did mine, I have 2 configs, 1 for Hub, and 1 for Node.  It installs SeleniumGridExtras on the machine, with a configuration file, and Selenium Grid Extra using it's autoupgrade feature will download the latest WebDrivers.


The end result is you can use the URL of either gist to instantly setup a Selenium Grid machine.

No comments: