Working with Cucumber on the Windows platform

Frequently I teach classes on Cucumber for individuals in the testing community. Often this is their first exposure to Ruby and Cucumber and they usually have laptops running Windows. A week before the class I send out a document detailing software to install prior to their arrival. Nearly every time somebody has difficulties installing or verifying the installation of these tools. This post is designed to help people in a similar situation with step by step instructions on getting Cucumber running on your Windows computer.

Installing Ruby

Go to the rubyinstaller site and download the latest version of the ruby installation. If you plan to use Watir you should install a 1.8.7 version as it is not yet running properly on 1.9.2. When installing ruby pleaes make sure you select the option to “Add Ruby executables to your PATH”. When the installation is complete open a command window and type ruby –v. You should see a printout which includes the version of ruby you just installed. If you do not see the printout please try to install Ruby again and make sure you select the option to “Add Ruby executables to your PATH”. Then open a new command window and type ruby -v again. If you still do not see the output then it is possible that your computer is somehow locked down and you do not have permission to update your path. Try the option in the next paragraph and if that still doesn’t work then have somebody from your support organization help you with this.

If you do not see this then you will need to add the <RUBY_INSTALL>/bin directory to your path. You do this by right-clicking on My Computer and selecting Properties. Next select Advanced system settings and then select Environment Variables. Add a new User variable by pressing the Add button below the top section. Add an entry for Path and enter the path to the bin directory under the Ruby installation. When you are finished press the OK buttons to close all dialogs. Open a new command window and type ruby -v. Ruby should now be in your path and the command should print the version.

When you are finished close the command window.

Installing Gems

Rubygems goes across the Internet to install gems and all of their dependencies. Let’s try to install Cucumber by executing gem install cucumber from a command window. If this doesn’t work you will most likely need to configure your proxy settings. See the Configuring Proxy Settings section below. Otherwise you should execute cucumber --version from your command window. Again, this should print the version of cucumber that is installed. Now you may continue installing gems.

The following is a list of gems that I have found particularly useful when using Cucumber for testing various applications. If you wish to learn details about any individual gem just simply perform a google search. You should find documentation and examples for each one. Install the following gems by executing gem install and then the value below. During the installation of some of the documantation you might see a few errors but it is safe to ignore them.


Of course you might find other gems to use for your tests.

Configuring Proxy Settings

In your command window type the following replacing the values in between the < and > with the appropriate values. You should use your username and password. If you are unsure of the values for proxy-hostname and port please ask somebody in your support organization.

set HTTP_PROXY=http://<user>:<password>@<proxy-hostname>:<port>

Once you execute this line you should be able to execute gem install cucumber. Save this information someplace as you will need it every time you want to install gems. Now return to the previous section and install the remaining gems.

Other tools

If you plan to develop scripts you should consider using the RubyMine development environment. It understand and can run cucumber scripts and will greatly assist in your learning.

If you will be testing web applications I recommend you install Firebug plugin for FireFox. If you live in an Internet Explorer world then you should install the Internet Explorer Developer Toolbar.

9 thoughts on “Working with Cucumber on the Windows platform

  1. Pingback: Tweets that mention Working with Cucumber on the Windows platform | CheezyWorld --

  2. Hello,

    Thank you for writing this up, please update your post as the following items are invalid:

    * RubyInstaller includes rubygems, there is no need to manually install it over. This is valid for all the Ruby versions

    * Cucumber and RSpec do not depend on win32console anymore, they endorse the usage of ANSICON for console coloring.

    * You can reinstall RubyInstaller and click “Add Ruby to the PATH” to avoid the manually playing with Environment variables (which btw requires backslashes, not forward slashes)

    Hope all this info is helpful.

  3. Pingback: Working with Cucumber on the Windows platform

  4. Great post! Though one quick correction: To install ActiveRecord for use with Ruby, the following from a shell prompt – “gem install activerecord”.

  5. great article.. Everything as been explained very clearly.. This was the first time I was using Ruby and cuucmber,, I believe couldn’t have asked for better details.. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *