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!
- Download the Qt non-debug Cocoa package [ Direct Link ]
- add
gem "capybara-webkit"
to yourGemfile
- Change the Capybara Javascript driver to webkit in
env.rb
,Capybara.javascript_driver = :webkit
Comments
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..)
Thanks!
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?