Hi folks.
I’ve been busy pushing out a little micro-small shopping cart system, but multiple projects keep dragging on, and “project hang” locks me down. I am getting things done, but there’s just much of it all.
Today I needed a smarter way of walking through a series of screens to “buy a certain product” at my shop. Clickety-click.
Click manually is always a hassle. And you lose mental focus. Your mind starts to wander. You are grasping for that last thought, trying to concentrate, and wham, you lose it.
*Solution*: Using [Watir](http://wtr.rubyforge.org/), an automated functional test package, written in Ruby, you just type up the sequence… in Ruby, and then run that test script. Whenever you need to step through that process. Auto-magical testing. [Get going, using it, you too](http://wtr.rubyforge.org/watir_user_guide.html).
Watir’s gotten quite the following, in many circles, and it is seen by [some](http://helenius.dk/) as the next [“inroad to Ruby”](http://helenius.dk/archives/2005/09/27/vejen-til-ruby/), besides [Ruby on Rails](http://www.rubyonrails.com).
You can do as little or as much output and test logic as you please. I like the “dot means pass and F means fail” approach to output. Watir itself has very fine error messages, as when I tried to “click” a submit button that was hidden by CSS:
> OLE error code:800A083E in htmlfile
>
> Can’t move focus to the control because it is invisible, not enabled, or of
> a type that does not accept the focus.
Reading that, I found the culprit, changed it for testing’s sake, and then re-ran the test, successfully.
This was all in all a pleasant experience. Very Ruby-like: I got what I expected, and not so much else. Without pain or discomfort.
Tobin Harris: this is for you – Scott Hanselman on “Integrating Ruby and Watir with NUnit”.