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.
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.
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
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
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
- 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!