# Scripting Web Tests

with Watir and Ruby

Workbook / Install / Ruby

## Installing Ruby

Watir uses the Ruby language. It is a scripting language that is powerful and easy to learn. We install it using the One-Click Ruby Installer. It bundles Ruby with related utilties, including the Scite editor that we use in this tutorial.

On the CD you will find ruby185-24.exe.

1. Double-click this exe file to install.
2. Select the default installation options (choose all options; install in c:/ruby).
3. If you are installing as Administrator you don’t need to restart windows. Otherwise, you should.

Next > Install Watir and Rspec

## Alternate Versions of Ruby

If you already have Ruby installed on your machine, you might prefer to use it. We believe that the class materials will work with the following versions of Ruby.

- 1.8.2 (see below)
- 1.8.4
- 1.8.5
- 1.8.6 (see below)

It is also possible to install multiple versions of Ruby in different directories. This is complicated, but works. (We’ve done it.) You will have to manage your PATH to make sure that you get the version you want. The default PATH will point to the last one you installed.

### Ruby 1.8.2

You should update the gem system if you are using Ruby 1.8.2. This requires internet access.

    > gem update --system

### Ruby 1.8.6

In general we do not generally recommend using Watir with Ruby 1.8.6 because of a bug in 1.8.6 that prevents test failures from being signalled to supervising programs, such as Cruise Control. However these problems should not interfere with the tutorial itself.

This problem is described in more detail here:

- CruiseControl.rb documentation (see “Prerequisites”)
- Watir, Nant and Cruise Control

## Background Information

You can find all versions of the Ruby One-Click Installer online.