31 July 2012

Watir and Ruby

I started QA / Web automation in a language called Groovy.  I found it very difficult to pick up.  The people who suggested it as a useful language felt it was easy for newcomers to pick up. 

The problem with Groovy is:
  • The training resources are written for Java developers.  If you're not a Java developer you almost need to pick up Java first then learn Groovy - which is entirely backwards to the goal
  • Groovy has little support out there, compared to Ruby
  • Pain in the Ass to set up an automation framework in it.  Very fragile.  I've been using GEB - but you end up having all sorts of conflicts with the Groovy compiler verison, Webdriver verison, Spock version, etc.   It's constantly needing supervision and maintenance. 
The upside of Groovy is:
  • Native use of Java (you can just type Java code and the Groovy compiler will run it)
  • Native support for JODBC drivers.
But tonight, having never used Ruby, I decided to try and install Watir to see how daunting a task it would be. 

In less then about 20min (10min to install Ruby and Watir) I was able to write a test in the Watir framework. 

Groovy took me months to get the GEB framework going. 

I love IRB - interactive ruby is so great to actually see how to drive the browser before comitting to code... I can just type:
irb
>require "watir"
>browser=Watir::Browser.new

At this point a default browser spawns!

>browser.goto "watir.com"

It pulls up www.watir.com

Pretty nifty and easy.  IRB is great to just see what you want to get done. 

I'm not sure yet if Watir will have the great JQuery that Groovy has built in, but I'll give it a spin and see how it works out.

No comments:

Post a Comment