Getting Started with Ruby Cucumber on Windows 10

Ruby can be a great language for testing. With libraries like Capybara for driving web apps and JSON, RestClient, SOAP, and others for interacting with service apps, you’ll find testing in Ruby requires much less code than in C# or Java.

Following instructions can be used to setup Ruby Cucumber on windows 10. Following instruction have been tested on windows 10. Should work on Windows 8.1.


As a first step download and install Ruby from . Install the latest release of version 2.2.4 64 bit or 32 bit whichever applicable From <> . I will be using 32 bit version. The 64-bit versions of Ruby are relatively new on the Windows area and not all the packages have been updated to be compatible with it.

Installing Ruby cucumber on Windows 10

Make sure you check the option to “Add Ruby executables to your PATH.”

Step 2

Also install the Ruby Development Kit from the same place, which will allow Ruby to build native extensions for libraries.

Instructions are available here:

Note: while installing, check if you are installing the right version of DevKit.

C:\devkit> ruby dk.rb review
C:\devkit> ruby dk.rb init
C:\devkit> ruby dk.rb install

Step3: Install Ruby Cucumber Gems

To install Cucumber, first update current gem setup.

C:\Users\pintu>gem update --system:

Next, install the gems you need for cucumber web testing. Following are recommended

C:\Users\you> gem install --no-ri --no-rdoc rspec
C:\Users\you> gem install --no-ri --no-rdoc win32console
C:\Users\you> gem install --no-ri --no-rdoc watir-webdriver
C:\Users\you> gem install --no-ri --no-rdoc cucumber
Run Cucumber
C:\Users\you\Documents> cucumber

If you try to run Cucumber at this stage you will get an error of missing features. Refer the screenshot.

Ruby Cucumber on Windows 10 -2

C:\Users\you\Documents> cucumber --init
C:\Users\you\Documents> cucumber
You are now done.
Next -> Writing  your first test using ruby & cucumber on windows 10

Selenium Ruby Binding – how ?

Good part of selenium is that the selenium tests can be written in multiple programming languages like c#, Java, Perl, PHP, Ruby etc. I normally hear saying that “This Java project, so we can write tests in Java as well”.  The only advantage I see with this is that you can get help from development team incase you are stuck somewhere. But if you are good at c# or any other language it should not be an hindrance. Test framework will be different that coding framework unless you want to integrate it.

I covered Java and C# in most of my previous posts. Here I will be using Ruby to write the Selenium tests.

 A simple Ruby Test

require "selenium-webdriver"
driver = Selenium::WebDriver.for :firefox ""
element = driver.find_element(:name, 'q')
element.send_keys "Hello Selenium WebDriver!"

require “selenium-webdriver”  – This is similar to import in Java and using in c#

The above example is without using any Test framework. In Ruby you can use Test Framework as you do with C# ( NUNIT test framework) and Java( JUNIT or TestNG framework).

In Ruby you can use minitest or BDD framework  RSpec or Cucumber

Structure of RSpec test

load File.dirname(__FILE__) + '/test_helper.rb' 
#'describe' marks the a test group
describe "Selenium Ruby Tests" do 
include TestHelper
 # 'it' marks the start of a test case, ends with the matching 'end'
it "Start Chrome" do
 browser = Selenium::WebDriver.for(:chrome)
 sleep 1
it "Start FireFox" do
browser = Selenium::WebDriver.for(:firefox)
 sleep 1
it "Start IE" do
 browser = Selenium::WebDriver.for(:ie)
 sleep 1

For more information on RSPec click here .