blog

Let's talk about testing

Complete setup guide for Ruby, Cucumber and Watir or Selenium webdriver on Windows

This entry is part 3 of 10 in the series Test Automation
This blog post is outdated. Please refer to our updated setup guide instead.

Hi All,

We have seen quite some people having trouble getting a proper test automation setup using cucumber and watir-webdriver or selenium-webdriver. Here we describe the minimum number of steps to get your cucumber with watir/selenium-webdriver up and running.

Step 1 – Install Ruby


Download and install rubyinstaller-1.9.2-p180.exe.

Explanation/details:

rubyinstaller-1.8.7-p334.exe would also work

Step 2 – Extract DevKit


Download and extract DevKit-tdm-32-4.5.1-20101214-1400-sfx.exe to a folder you like.

Explanation/details:

Make sure you create a new folder, it extracts the lib and bin folders to that location, there is no root folder such as DevKit for example.

DevKit is needed because Cucumber requires the json gem. Without installing DevKit you would get the error:
ERROR: Error installing cucumber:
The 'json' native gem requires installed build tools.

Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'

Step 3 – Install DevKit

Goto the root folder where you extracted DevKit and execute the commands:

ruby dk.rb init
ruby dk.rb install

Step 4 – Install the required gems

Execute:

gem update --system
gem install rspec --no-ri --no-rdoc
gem install win32console --no-ri --no-rdoc
gem install watir-webdriver --no-ri --no-rdoc
gem install cucumber --no-ri --no-rdoc

Explanation/details:

  • Installing rspec because it is a commonly used gem.
  • win32console supports colored output on the dos command line when executing the tests!
  • watir-webdriver requires selenium webdriver, so that one will be installed always. If you only want selenium-webdriver, just do gem install selenium-webdriver instead.

When creating an install_gems.bat file inlcuding these commands, make sure to use the CALL command, e.g:

CALL gem update --system
CALL gem install rspec --no-ri --no-rdoc
CALL gem install win32console --no-ri --no-rdoc
CALL gem install watir-webdriver --no-ri --no-rdoc
CALL gem install cucumber --no-ri --no-rdoc

Step 5 – Start with your Cucumber and Webdriver setup

New to cucumber? Have a look at our Web Testing With Cucumber blog!


  • geshuni

    Thank you a lot, mate. Really useful info. I was able to run rails under win7 =)

  • Good post! Congratulations!

  • Anil

    thank you man!! useful at a right time

  • Nate

    Where’s the rest? It stops at the beginning of step 5… Checked the link and it does not include a Complete setup for Cucumber and Watir-webdriver…. This guide only tells us how to install them… which i’ve already done…

  • Abrahim

    very nice post..very helpful

  • Sameer Sawant

    Selenium-cucumber is a behavior driven development (BDD) approach to write automation test script to test web applications.
    http://seleniumcucumber.wordpress.com/

Reputation. Meet spriteCloud

Find out today why startups, SMBs, enterprises, brands, digital agencies, e-commerce, and mobile clients turn to spriteCloud to help improve their customer experiences. And their reputation. With complete range of QA services, we provide a full service that includes test planning, functional testing, test automation, performance testing, consultancy, mobile testing, and security testing. We even have a test lab — open to all our clients to use — with a full range of devices and platforms.

Discover how our process can boost your reputation.