Thursday, January 27, 2011

Ruby & Watir in Five Minutes

I have decided it was time to automate some of our web tests for a variety of reasons. If I have to convince you why to automate then your reading the wrong blog. I have choosen to use Watir (Pronounced Water). Watir is a free open source Ruby Gem.

I found getting Ruby and Watir up and running to be a fairly smooth process; however, some of the documentation on line wasn't 100% accurate. My goal is to give you the info to get up and running as quickly as possible. The information in this post applies only to Windows

Step 1 - Installing Ruby

  1. Install Ruby - I have had errors using the 1.9.X branch, things run much smoother with 1.8.7

Step 2 - Installing Watir as a Ruby Gem

  1. Open your favorite command prompt, and make sure you have the latest version of Ruby Gem's:
    gem update --system
  2. Install watir using:
    gem install watir
  3. If you want to use firefox you'll need to install this extension for Firefox 3.6

Step 3 - Your First Test Case

The directions at watir's site are very good for creating your first test case. The one important detail is before the step where you should enter require 'watir' you need to do require 'gemsystem'.

No comments: