The Search for Speedier Javascript Scenarios

We kicked off a new project a few weeks back; Rails 3.1, heavier-on-the-JavaScript side kind of project. When we started, I had recently upgraded to FireFox 5 and it didn’t want to cooperate with the test suite. I went hunting for alternatives, settling on chromedriver and capybara-webkit.

After a couple days of development and testing between Chrome and capybara-webkit, I tweeted:

very simple Cucumber suite using Selenium; Chrome: 36 seconds, Firefox: 25 seconds. Using capybara-webkit: 7.5 seconds.

capybara-webkit is a headless (meaning it doesn’t have a graphical interface) WebKit driver using the WebKit implementation found in Qt. If you’re not familiar with Qt, it is a cross platform application and UI toolkit. Built by thoughtbot, I suggest you read their quest for full-stack testing here and here if you’re curious how they came to building capybara-webkit.

Installing capybara-webkit on OS X is straightforward. Do give it a try!

  1. Download the Qt non-debug Cocoa package [ Direct Link ]
  2. add gem "capybara-webkit" to your Gemfile
  3. Change the Capybara Javascript driver to webkit in env.rb, Capybara.javascript_driver = :webkit
Photo of Brian Ryckbost

Brian is vice president and a veteran software developer. He pairs his technical vision with an entrepreneurial mind to drive the company forward. A graduate of Calvin College with a degree in Computer Science, he lives in Holland, MI with his wife and three kids.

He has never seen the classic 1984 comedy Ghostbusters.


Post a Comment

(optional — will be included as a link.)
  1. Hey, have you been able to use stubs with webkit as javascript driver? I know that it works in separate threads but it interesting how selenium is working with stubs. (I know that in stubs are not for acceptance testing but sometimes they are still needed for example to stub external service or stub generation of random thing like tokens, passwords etc..)

    July 23, 2011 at 14:39 PM
  2. Many thanks for the excellent writeup. It the truth is had been a amusement accounts it. Glimpse leading-edge to considerably included acceptable from you! By the way, how could we communicate?

    September 07, 2012 at 1:59 AM