# Scripting Web Tests

with Watir and Ruby

Workbook / Install / Watir and Rspec

## Installing Watir and Rspec

Watir is a gem, a Ruby library package that can be automatically downloaded and installed with a single command. In this tutorial, however, we don’t assume internet access and thus install gems from CD.

The Watir gem provides commands for driving a browser. This tutorial also uses Rspec, a gem containing an agile testing framework. It allows us to organize our tests into test cases, execute the tests, and collect the results.

Here is how to install Watir, Rspec and the other libraries that they require.

1. Open a “cmd” window and change the current directory to the base directory of the CD. This example assumes your CD is your E: drive.

       > e:
       > cd \

2. Install Watir

       > gem install --local watir --include-dependencies

3. Install Rspec

       > gem install --local rspec

Next > Install the IE DOM Explorer

## Background Information

If you type

    > gem install watir

by default you will get the latest version of Watir hosted at Rubyforge.org, which at the time of this writing is 1.4.1. We do plan to update this shortly to be the same as the version used in the tutorial.

Rspec was actually designed as a framework for Behavior-Driven Development, a design approach that expands on Test-Driven Development. We aren’t really using it for its intended use. Rather we are simply using it for testing.