Past few days I have been playing with using Watir in my current project. I bet it has been fun. Watir gives this awesome power for automated testing. Many would argue why not Selenium for that matter. There were few challenges using Selenium:

Feature Watir/Watij Selenium
Frames and popup support Easy Has problems
API for database connectivity Easy Doesnt have API support
Multi language (non-ascii character)support Easy No
Recorder Yes Only for FF
Integration with Rspec Easy to create a test suite. See example below
Cross domain support Yes No
Ajaxified responses Yes Difficult

One of the fun part was attaching your browser instance to your IRB. The examples here is self sufficient explanation. If not, then watir-console is theie for rescue.

Not to forget the Excel Interface Class, which we used to download an excel report (as part of our project) and match the values against DB records.

The rspec task to run the tests as a suite and also lets you connect to environment specific database:

desc “Run all watir tests ”
namespace :spec do
  Spec::Rake::SpecTask.new(:watir) do |t|
    ENV[“WATIR_ENV”] = ENV[‘env’] ? “#{ENV[‘env’]}” : “development”
    t.spec_files = FileList[‘test/integration/watir/*_spec.rb’]
    t.spec_opts = [“-fh > public/watir_results.html”]
  end
end

From the command prompt you could run:

rake spec:watir (runs and connects against development database)
rake spec:watir env=qa (runs and connects against qa database)

Lately, a lot of progress has been made on Watir Recorder