Setting up Cucumber + Webrat + Selenium

Posted by The Sauce Labs Team in EventsSelenium Resources

There's quite a bit of information out there on getting these disparate tools to work together, but a great deal of it is out of date. To clear things up a bit, I've documented all the gems and modifications necessary to get these pieces of open source software up and running together. As time goes on, I'll be expanding this blog post with notes about the pitfalls and various platform issues that may be discovered (I'm looking at you, Snow Leopard), but this should get most people up and running right away.

This is all using a clean REE environment via the poorly named but wonderfully written rvm, or Ruby Version Manager.

Gems you'll need: gem install actionmailer actionpack activerecord activeresource activesupport builder cgi_multipart_eof_fix cucumber cucumber-rails daemons database_cleaner diff-lcs fastthread gem_plugin gherkin json json_pure mime-types mongrel net-ssh net-ssh-gateway nokogiri rack rack-test rails rake rdoc rest-client rspec rspec-rails Selenium selenium-client sqlite3-ruby term-ansicolor trollop webrat

Some of those are not strictly necessary, but simply nice to have, while others solved some unexpected problems with the bare necessities. I'll prune this list as feedback comes in from people's experiences.

Points to watch out for: Nokogiri: This was easily the worst on my Snow Leopard machine. It relies on the native libxml2, which had problems with 32/64 bit compatibility. No matter what I tried, errors kept coming up. I had to clean everything out with my MacPorts installation and force a universal installation. Webrat: The Selenium server jar that was included by default caused no end of headaches. I had to manually go in to the directory, remove the default server jar, and download the newest version from the seleniumhq download page.

Once those are set up, you should be able to use Cucumber, Webrat, and Selenium together without too much headache. Then you can refer to our webinar video (which will be posted to the blog later this week) to learn how to use Cucumber to easily run Webrat and Selenium.

Discuss: Setting up Cucumber + Webrat + Selenium

Free Trial

Get access to a free 14-day trial version, or contact Sales for more information.