Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Google Chrome joins Simpletest Selenium framework for Drupal

Parent Feed: 

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.

Example tests are available in Selenium module itself.

More information about ChromeDriver on the project's wiki.

My previous posts about Selenium:

Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web