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