Set up Ruby & Watir in 3 Easy steps

NOTE: These instructions are pretty old!! The “Quick Start” instructions are a better way to get started.
http://wiki.openqa.org/display/WTR/Quick+Start

Watir (Web Automation Testing In Ruby) is an open-source library that automates Internet Explorer browser actions on Windows. Watir drives browsers the same way people do. It clicks links, fills in forms, presses buttons. Watir also checks results, such as whether expected text appears on the page.

Watir is built on the Ruby scripting language. Like other programming languages, Ruby gives you the power to connect to databases, read data files, export XML and structure your code into reusable libraries.

The Three Essentials are :

  1. Get Ruby.
    The current installer for Windows is ruby186-26.exe, available from rubyforge.org (24 MB download, as at November 2008). Install it to the default location, C:\ruby.
    http://rubyforge.org/frs/?group_id=167&release_id=17128
  2. Get Watir.
    The package watir_156.msi installs Watir with its required dependencies (8 MB download from justaddwatir.com).
    http://justaddwatir.com/watir/wp-content/uploads/watir_156.msi
    Note: there are other methods of installing Watir (via Ruby commands) but this is the simplest solution.
  3. Get the IE Developer Toolbar.
    The package IEDevToolBarSetup.msi installs the Internet Explorer developer toolbar (0.6 MB download from microsoft.com).
    http://xhref.com/1300c

Note: You must have local administrator privileges to install Ruby and Watir. After installing, log off Windows or restart, to ensure Ruby is added to your environment correctly.

Now you’re set up: to become a Watir guru, some time must be spent becoming proficient with :

  • Ruby syntax – learning curve is OK if you’re familiar with scripting or development
  • Watir syntax – an uncomplicated library that enables Ruby to drive IE directly via OLE
  • SciTE editor – a lightweight IDE that’s included with Ruby (alternatively the Eclipse IDE is excellent but complex)
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s