Main menu

Google Chrome joins Simpletest Selenium framework for Drupal

Submitted by ygerasimov on Thu, 07/21/2011 - 23:08

One of the modules I am involved in is Selenium module. In brief it integrates Selenium2 to simpletest framework of Drupal. From the beginning it was possible to run test in Firefox that opens pages of the simpletest sandbox. As we are in full control of browser we are able to test javascripts in it. This is the main goal of the Selenium integration.

The great achievement in the work on Selenium module is adding another browser to the framework -- Google Chrome. Now we can write tests that will run in either Chrome or Firefox.

In order to run tests in Chrome we need to download two Selenium products: Selenium standalone server (http://seleniumhq.org/download/) and Chome Driver (http://code.google.com/p/chromium/downloads/list). Then we should add ChromeDriver to PATH variable and run Selenium server. When Selenium server receives request to open Chrome browser it will connect to ChromeDriver and communicate all the commands in this way.

Unfortunately there are some limitations in ChromeDriver comparing to Firefox. Main thing is that ChromeDriver cannot upload files (reported issue 1 and issue 2. I hope these issues will be solved soon. Another minor issue is that in ChromeDriver we cannot select options in selectbox using native select() method. But we can do that with click(). I am sure that we will face more differences between FirefoxDriver and ChromeDriver.

At the moment Selenium module already implements most of the simpletest methods (like different asserts, drupalGet, drupalPost etc.), so writing tests should be familiar thing for everyone who wrote simpletsts. But please remember that Selenium testing has completely different nature than unit testing. Selenium testing is automating of manual testing. So we should try to write tests like if user manually does testing.

Interesting project SAHI. I think it is very close to Selenium RC as it also runs on javascript. Also I found that SAHI doesn't have PHP driver. Selenium2 communicates with browsers directly (not via javascript), so it makes big difference.

Selenium's technology ambition is good, but unfortunately it is not stable enough and our testers find it too complex. Our personal experience says SAHI is the future. The Behat framework from Symfony has a PHP driver for SAHI.