WATIR Web Testing Tool all the Rage at AWTA
Experiences using Watir and Atomic Object’s upcoming open source contributions to simplify it generate excitement at AWTA.
WATIR (pronounced “water”) made a big splash – or maybe it was a cannonball – at the Sixth Annual Austin Workshop on Test Automation ( AWTA ). Held January 7 – 9, 2005, the workshop attracted top developers and testers in the open source arena. The workshop’s goals were to review and contribute to open-source tools for the functional testing of web-based applications. Although the event wasn’t intended to be focused so directly on Watir, it clearly moved in that direction.
“Watir may actually become the killer app that makes Ruby the de facto language for testing.” Brett Pettichord, Director of Testing Practice, ThoughtWorks
”... after seeing what Watir could do and how neat Ruby is, I became a convert.” Elisabeth Hendrickson, Independent Consultant, QualityTree.com
“In my opinion, Watir has no peer as a framework to drive functional test automation in Internet Explorer.” Chris McMahon, Test Engineer, Verint Corporate
What is WATIR?
Watir (Web Application Testing in Ruby) is an open source tool used for automated testing of the Internet Explorer (IE) web browser. It uses the Ruby scripting language to drive IE using Microsoft’s OLE interface. Users write Ruby test scripts for their web application and then run them in the IE browser.
Many application developers realize the value of automated testing. How sweet it is to have a set of automated tests already written for an application that needs to be revised. With a simple click of the automated test button the developer knows if something they changed broke another part of the code, and if so, where it broke.
Applications can change quite often, but websites change even more often. Watir is a real breakthrough in moving website testing into the automated test realm that is so prevalent in quality application development. It can be used to test anything from broken links and missing logos to field completion and database queries… all in beautifully automated fashion.
Currently Watir runs only on the Windows platform, and can be used for testing HTML pages (if you can see code by selecting View/Source, Watir can test it). The Watir project is headed up by Bret Pettichord and Paul Rogers. As announced in the blog of nationally known tester and author Brian Marick, “They’re going to take the existing Web Testing in Ruby framework and push it forward full throttle. This will be a project to watch – and to contribute to.”
Simplifying WATIR
A team of Atomic Object developers (Karlin Fox, David Crosby and Andrew Witte) have been working quite heavily with Watir, having developed automated web tests for four projects to date. Being the test-infected developers that they are, and always striving for greater efficiencies, they created a library and a framework tool that simplify the interface to WATIR, named Watir::Simple and SYSTIR (System Testing in Ruby) respectively.
Watir::Simple makes it possible to write tests that look a lot like pseudocode, but that actually work. For example, if a test requirement was to open a browser and type the word “Paul” in the “Username” field, it would be automated in Watir using the following Ruby script:
1 2 3 |
ie = IE.new ie.goto("http://myserver/mypage") ie.textField(:name, "username").set("Paul") |
This is standard Ruby code and is a little cryptic for the not-so-technical eye. Using Watir::Simple, this same test requirement could be written as:
1 2 |
new_browser_at "http://myserver/mypage" fill_text_field "username", "Paul" |
One must agree that this is quite a bit simpler. Atomic Object is working diligently to prepare Watir::Simple for release to the open source community as a part of Watir.
The Watir::Simple brainchild was a springboard for a framework tool developed by Atomic Object, dubbed SYSTIR. Using the same goal for simplicity and efficiency, SYSTIR takes Watir::Simple one step farther by allowing someone to write system tests using the domain language of the application being tested. For example, the test requirement above would be written in SYSTIR as:
1 2 |
load_my_page
login_as "Paul" |
SYSTIR makes writing test code almost as simple as writing a human language.
Interest in both Watir::Simple and SYSTIR at AWTA was intense. “We are keenly looking forward to the release of these libraries,” remarked Brett Pettichord.
Like Watir::Simple, SYSTIR is also being prepared for contribution to the open source community. Unlike Watir::Simple, plans are to keep it separate from Watir. According to Karlin Fox, one of SYSTIR’s developers, “We’ll start with a release of SYSTIR geared specifically for Watir, but the beauty of this framework is that it can be used with other applications besides Watir. That’s the main reason we we’d like to keep it a separate contribution.”
Atomic Object plans to release Watir::Simple and SYSTIR to the open source community later this month.
Leave a Reply