Let's talk about testing

Complete Setup Guide for Ruby, Cucumber and Watir on Windows (2017)


Our last post on installing Ruby, Cucumber and Watir was written in 2015. But since then, things have changed and software has been updated, so it’s time for another update!

What is Cucumber?

Cucumber is an open-source software tool that is used for test automation. It works off the concept that test cases should be captured in human language (a form of structured English called Gherkin), but automating the execution of test cases is best done in a programming language. The Cucumber tool provides the glue between the two, reporting test results in human language so that they are easily understandable to all stakeholders.


Software Versions

These instructions have been tested on Windows 10 64-bit, but should also work on Windows 7 and 8.1. We’ll be using the 64-bit versions of software where we can, but if you are running a 32-bit system you can install the 32-bit versions instead. But you should probably upgrade! I also assume that you have installed Firefox already, if not you can get Firefox here.

Step 1: Install Ruby

Since Windows does not have a fancy package manager installed by default, like OSX or most Linux distributions, we will have to install Ruby with the RubyInstaller that you can find here. We are going to install the 64-bit version of Ruby 2.4.2. Download the Ruby 2.4.2-2 (x64).exe file, run it, and follow these steps:

1) Click ‘I accept the License’ and click ‘Next’.
2) Make sure ‘Add Ruby executables to your PATH’ and ‘Associate .rb and .rbw files with this Ruby installation’ are selected, and click ‘Install’.
3) Let the Installer run, when it’s finished, make sure ‘Run ‘ridk install’…….’ is selected and click ‘Finish’.
4) You should get to this screen, where you can press ENTER:

RubyInstaller 2 window

5) Now you’ll get to the installer for MSYS2, which we’ll need for a couple of functions in Ruby. Click ‘Next’.
6) Click ‘Next’.
7) Click ‘Next’ and let the installer finish.
8) Once the MSYS2 installer has finished, uncheck ‘Run MSYS now.’ and click ‘Finish’.
9) Ruby is now installed.

Step 2: Install Chrome and Firefox drivers.

In order to let Cucumber and Watir start and control the browser, we have to install ChromeDriver and GeckoDriver. Watir will use ChromeDriver and GeckoDriver to load websites and perform actions on those websites. ChromeDriver will do this if we want to use the Chrome browser, and GeckoDriver will do this when we decide to use Firefox for our tests.

1) Download the latest version of geckodriver here.
2) Download the latest version of ChromeDriver here.
3) Extract both zip files to ‘C:\Ruby24-x64\bin’, or where else you’ve installed Ruby.

Step 3: Install Bundler and Lapis Lazuli

In order to get our first automated test suite set up fully, we have to install two Rubygems, Bundler and Lapis Lazuli.

1) Start PowerShell by pressing (Windows key + R) and enter ‘powershell’ in the popup. This can also be done in Command Prompt, but here we are using PowerShell as an alternative.

Opening PowerShell

2) A PowerShell window should open. Type ‘gem install bundler’ and wait until the installation is complete.
3) Now type ‘gem install lapis_lazuli –no-ri –no-rdoc’ and wait for the installation to finish.

Installing Rubygems with PowerShell

4) You’re done!

Step 4: Create your first test suite

Now it’s time to create our first test suite!

1) Create the directory in which you want to store your Ruby projects. For example, I use C:\projects\ruby.
2) Start PowerShell like we did in step 3, and go to your newly created folder by typing ‘cd c:\projects\ruby’.
3) Now type ‘lapis_lazuli create my-first-test-suite’.
4) Lapis Lazuli has now created a new test suite for us, so go into its relevant folder with PowerShell by typing ‘cd my-first-test-suite’.
5) To run the test suite, we first have to install all of its dependencies that are specified in the ‘.gemfile’ file. We do this by typing ‘bundle install’ and waiting. This can take a few seconds, but it installs Cucumber, Watir and some more gems to your system.
6) Done! We have created our first test suite and we are able to run it by typing
bundle exec cucumber’. Congratulations!

As far as these installation instructions go, we’re done and you are ready to go with test automation. But if you want to learn how to use Cucumber and Watir to start automating tests for your web application, you can check out our other resources over at

2 responses to “Complete Setup Guide for Ruby, Cucumber and Watir on Windows (2017)”

  1. […] entry is part 3 of 11 in the series Test Automation This blog post is outdated. Please refer to our updated setup guide […]

  2. […] entry is part 7 of 11 in the series Test Automation This blog post is outdated. Please refer to our updated setup guide […]

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.

We use cookies to give you the best browsing experience possible. For more information, please read our cookie policy.

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.