Watir: Another sweetspot for Enterprise Ruby

There are many speculations regarding Ruby (the programming language) and it’s ready-ness for enterprise use. The other day, a colleague of mine found an absolutely sweet spot: Automated testing via the browser interface.

Watir stands for “Web Application Testing in Ruby”, you write a few lines of Ruby that fires up Internet Explorer, and then clicks around, fills in form fields, submits, etc.

My colleague used a couple of hours to write a few lines to integration test a complex system for a financial customer. He modified it to repeat the same test in three different environments and via timers found out that one of the environments performed very badly.

I saw my colleague demo it yesterday, and both testers and developers present were absolutely impressed by the jar-dropping demo. Comments: “We could have used this much earlier”, “Despite that I don’t know Ruby, It’s easy to understand what it does”. Everybody in the project room went around smiling (David Heinemeier would probably say “happy”)

It’s nothing new that automated browser testing can be done, but when I ask about the alternatives, I’m told that they’re too complex to get started with, and sometimes take forever to set up.

Watir gets started with just four lines of code:

[code lang=”ruby”]require ‘watir’
require ‘watir/WindowHelper’
include Watir

ie = IE.new
ie.goto(test_site) [/code]

In my opinion, Watir + Ruby is a winnner. So easy to get started. So great payoff for a small amount of time invested. Jaw-dropping reactions on developers and testers that don’t even know Ruby. It’s a definite winner.

Technorati Tags: , , ,

7 Responses to “Watir: Another sweetspot for Enterprise Ruby”

  1. Heiko Says:

    Hi!

    Selenium is also easy and good.
    http://www.openqa.org/selenium/

    +

    http://jameleon.sourceforge.net/

    http://sahi.sourceforge.net/

    Heiko

  2. Tobias H. Michaelsen Says:

    You should also check out Scott Hanselman’s WatirMaker. It is a recording program for generating runy scripts for Watir automatically. It is written in C# and is Windows-only. But a Ruby version has also been made.

  3. Tobias H. Michaelsen Says:

    “runy script” – argh! :) Should have been “Ruby”

  4. Jesper Rønn-Jensen Says:

    Thanks for the comments.

    After spending some more time working with Watir, this is great news that you can record them. Thanks for letting me know, I’ll look into that first thing Monday morning!

  5. Olle Jonsson Says:

    I found an old post at my blog, almost a complete mirror of these sentiments.

    As a lone consultant, I had to celebrate its genius alone. :-)

  6. justaddwater.dk | How to Run JavaScript From Watir Scripts Says:

    […] What’s Watir? Read “Watir: Another sweetspot for Enterprise Ruby” […]