QA/Execution/Web Testing/Automation/Selenium Grid

From MozillaWiki
Jump to navigation Jump to search

Selenium Grid

moz-grid-config

moz-grid-config is a project for managing our Selenium infrastructure. It includes the latest version of Selenium that we're using, and a mechanism for starting the hub/nodes. You can find documentation on moz-grid-config at the github project page.

Starting the hub

  1. Connect to qa-selenium.mv.mozilla.com
  2. From a terminal (you can use SSH, VNC, or Screen):
   cd ~/moz-grid-config
   ant launch-hub

Starting nodes

  1. Connect to the appropriate machine.
  2. From a terminal (you can use SSH, VNC, or Screen):
   cd ~/moz-grid-config
   ant launch-node

Shutdown

  • Terminate the process using CTRL+C

Architecture

We have several Mac Minis running Selenium nodes on the host as well as in VMWare Fusion virtual machines running Windows 7. All hosts can be accessed via VNC from within the MV-Office Intranet (VPN if offsite). The virtual machines can be accessed via VNC using port 5901.

Mac Minis

  • qa-selenium.mv.mozilla.com (10.250.1.143)
    • Mac Mini; 2.7 Ghz Intel Core i7; 8 GB
    • Mac OS X 10.7.4
    • Jenkins (dashboard)
    • Selenium Grid hub (console)
  • qa-selenium2.mv.mozilla.com (10.250.1.144)
    • Mac Mini; 1.83 Ghz Intel Core 2 Duo; 3 GB
    • Mac OS X 10.6.8
  • qa-selenium3.mv.mozilla.com (10.250.1.196)
    • Mac Mini; 2.4 Ghz Intel Core 2 Duo; 4 GB
    • Mac OS X 10.6.8
    • VM: Windows 7 Professional (10.250.7.78)
  • qa-selenium4.mv.mozilla.com (10.250.1.197)
    • Mac Mini; 2.4 Ghz Intel Core 2 Duo; 4 GB
    • Mac OS X 10.6.8
    • VM: Windows 7 Professional (10.250.4.68)
  • qa-selenium5.mv.mozilla.com (10.250.1.145)
    • Mac Mini; 2.66 Ghz Intel Core 2 Duo; 8 GB
    • Mac OS X 10.6.8
    • VM: Windows 7 Professional (10.250.5.71)
  • qa-selenium6.mv.mozilla.com (10.250.1.221)
    • Mac Mini; 2.53 Ghz Intel Core 2 Duo; 4 GB
    • Mac OS X 10.6.8
    • VM: Windows 7 Professional (10.250.2.244)
  • qa-selenium7.mv.mozilla.com (10.250.1.9)
    • Mac OS X 10.7.4, 2.5 GHz Intel Core i5; 4GB 1067 MHz DDR3
    • VM: Windows 7 SP1 pro

Android

  • WebQA Adi_Google Nexus Phone: (10.250.1.27)
  • WebQA Asus Tablet Connection: (10.250.1.28)
  • WebQA 09526 Google Nexus Phone: (10.250.1.25)
  • WebQA 09530 Google Nexus Phone: (10.250.1.26)

Node configuration

Since Selenium 2.14.0 was released and allowed both RC and WebDriver nodes to co-exist each node runs the same configuration of browser nodes.

Firefox version policy

Due to rapid release, we have adopted the following policy for Firefox versions available on our Selenium infrastructure:

  • Firefox Nightly
  • Firefox Aurora
  • Firefox Beta
  • Firefox Release
  • Firefox Release -1
  • Firefox ESR

WebDriver

Instances are currently set to 1 due to issues with focus.

  • Firefox 3.6 (x1) - to be removed
  • Firefox 7 (x1) - to be removed
  • Firefox 8 (x1) - to be removed
  • Firefox 9 (x1) - to be removed
  • Firefox 10 (x1)
  • Firefox 11 (x1) - to be removed
  • Firefox 12 (x1)
  • Firefox 13 (x1)
  • Firefox Beta (x1)
  • Firefox Aurora (x1)
  • Firefox Nightly (x1)
  • Internet Explorer 8 (x1)

Adding a new browser environment

Configuration

You will need to fork and clone from the moz-grid-config github repository and work on a new branch.

  1. Add the browser, alias, and path to grid_configuration.yml
  2. Add the browser, binary and details to the JSON configuration files
  3. Submit a pull request to the main github repository from your branch

Hub/Nodes

  1. Prepare Jenkins for shutdown - this will allow all currently running jobs to finish, but will not start any new jobs.
  2. Once no jobs are running, shutdown the Selenium Grid hub
  3. Pull in the latest changes from moz-grid-config
  4. Start the Selenium Grid hub
  5. For each Selenium node:
    1. Shutdown the Selenium node
    2. Pull in the latest changes from moz-grid-config
    3. Install the appropriate browser for the new environment
    4. Start the Selenium node

Installing Firefox

  • All new browsers should be installed with the version number in the path so that moz-grid-config can always find them!
  • Install mozdownload and mozinstall using pip to download and install the Firefox binaries.
    • use --help for both mozdownload tand mozinstall to see all available options
    • to download the latest release using mozdownload you can simply use: mozdownload -v latest
    • to download the latest Firefox Nightly build using mozdownload you can use: mozdownload -t daily --branch=mozilla-central
    • to download the latest Firefox Aurora build using mozdownload you can use: mozdownload -t daily --branch=mozilla-aurora
    • releases are also available to download manually here
Mac OS X
  • mozdownload -v 14.0.1 -d /tmp
  • mozinstall -d /Applications/ /tmp/firefox-14.0.1.en-US.mac.dmg
  • mv /Applications/Firefox.app/ "/Applications/Firefox 14.app/"
  • rm /tmp/firefox-14.0.1.en-US.mac.dmg
Windows
  • mozdownload -v 14.0.1 -d %TMP%
  • mozinstall -d %USERPROFILE% %TMP%\firefox-14.0.1.en-US.win32.exe
  • move %USERPROFILE%/firefox-14 "\Program Files\Mozilla Firefox 14"
  • del %TMP%\firefox-14.0.1.en-US.win32.exe

Setting hostname on Mac OS X

Shamelessly copied from http://budporter.net/?p=47

If you are running a version of OSX prior to 10.5, then look in /etc/hostconfig for the HOSTNAME= parameter and set it to be the FQDN (Fully Qualified Domain Name) that you want to use. So, for host foo located in the domain bar.com, the entry would be as follows:

   HOSTNAME=foo.bar.com

For OSX 10.5, /etc/hostconfig is being deprecated. There are a couple of preferred methods to do this in 10.5:

   sudo hostname -s foo.bar.com

or:

   sudo scutil –set HostName foo.bar.com

You can verify the change by issuing the following command:

   hostname

The output will display the FQDN of the computer.


Registering the Tegra Board to the Selenium Grid

Install and open the WebDriver Android (android-server-x.xx.apk where x.xx is current version) application on the Tegra board. Install the FlynnID python package on your computer. Open your terminal and type the following command

 flynnid --hubhost=[HUBIP] --hubport=4444 --nodehost=[NODEIP] --nodeport=8080 --browsername=browser --platform=ANDROID

where HUBIP is the hostname or IP address of the Selenium Grid and NODEIP is the hostname or IP address of the Tegra board

If everything goes right, you should see

  Registering the node to hub: http://qa-selenium.mv.mozilla.com:4444/grid/register
  Success!

You can check to see if the node is running by visiting the following url in your browser

  http://[NODEIP]:[NODEPORT]/wd/hub/static/resource/hub.html

where NODEIP is the hostname or IP address of the Tegra board and NODEPORT is the port the node is listening, the default is 8080.



References