Using Cucumber/Capybara with SauceLabs SauceOnDemand

March 3, 2011 Mike Gehard

SauceLabs is a cloud based way to test your site against different browsers.

Up until now, they only supported the older Selenium RC based tests.

For those of us using Capybara, we were out of luck because Capybara uses Webdriver.

Well that just changed, they now support Webdriver. Check out the instructions on how to get is set up here.

The one thing that I disagree with in that post is setting the default Capybara driver to :sauce (Capybara.default_driver = :sauce). This seems a little heavy handed to me since I may not want to run all of my scenarios through the Sauce driver.

Upon further review of the source code, it looks like after installing the sauce gem, they redirect any scenarios tagged with @selenium to the Sauce driver. I like this better so if you don’t want to switch over all of your scenarios over to Sauce, you can just ignore the line mentioned above and simply tag the scenarios you want to run on Sauce with @selenium.

I haven’t had a lot of time to play with this but at least it is a start in getting Capybara based Cucumber scenarios to run against Sauce Labs.

My next step is to figure out how to run one Cucumber scenario to run against multiple browsers on Sauce.

Another thing I’d like to figure out how to do is only run Selenium based tests on demand so they don’t run on Sauce every time I run my Cucumber suite. That could run up a decent Sauce bill, especially if you had multiple developers running Cucumber scenarios multiple times a day.

About the Author

Biography

Previous
Testing OmniAuth based login via Cucumber
Testing OmniAuth based login via Cucumber

If you haven't looked at OmniAuth for authentication with sites like Google, Github and Facebook, then you ...

Next
New Tech Talk: JRuby on AppEngine
New Tech Talk: JRuby on AppEngine

John Woodell, a JRuby developer from Google, describes the state of JRuby on Google's AppEngine. App ...