October 17, 2008

Two Ruby Books for Watir Testers

Many Watir users want to learn more Ruby so that they can build out their frameworks and libraries. When we created Watir, we knew that testers needed an easy-to-use full-featured language for their automation. Ruby allows most testers to quickly write simple Watir scripts. But as their tests grow and they need to add features and organization to their test suites, they are looking for more Ruby techniques. I pulled together several recommendations for ruby books some time ago. Today, I'd like to focus on the two books that I think Watir testers would benefit from the most.

After teaching Watir/Ruby scripting to dozens of testers, I've found that testers -- even those who insist they are not developers -- can learn effective programming techniques and concepts. But they need to be presented in concrete, practical contexts. Most programming manuals, on the other hand, use artificial examples assume an understanding of abstract concepts, such as exception handling or object-oriented programming. That's why they don't work for many testers.

If you are tester who knows some programming -- but not object-oriented -- and strongly prefers concrete, practical examples, then these recommendations are for you.

Testers looking to better organize their code and better understand how to use classes, modules and libraries will benefit from studying Everyday Scripting with Ruby by Brian Marick. It has a tutorial format, walking you through a series of increasingly richer examples. Previously, I said:

In Everyday Scripting with Ruby, Marick teaches the Ruby language by working through a series of practical scripts. These scripts accomplish everyday tasks that every tester can relate to: comparing file lists, monitoring code changes, scraping web pages, and using a notification framework. The book covers not only the Ruby language, including an excellent chapter on regular expressions, but also provides detailed advice on how to develop reusable libraries, something that Watir users are always asking for help with. If you are a serious Watir user, don’t hesitate to get this book.
Although this book only touches on Watir explicitly for a few pages, it actually has a deep connection. Back in 2002, Marick and I started teaching a class together called "Scripting for Testers". This class was based on our mutual conviction that testers needed to learn the fundamentals of scripting. Watir was one spin off from this class. The other is this book. Watir grew from a small library we used in the class to show how to use scripting to automate a browser. And Marick poured his commitment to teaching testers scripting into this book. As such, the book doesn't just teach Ruby, but rather is really focussed on teaching good development practices, such as when to use global variables and how to do test-driven development.

Marick's book has a tutorial format suitable for serious study. Another good book for testers is the Ruby Cookbook, By Carlson and Richardson. It consists of over 300 recipes, each only a few pages, that can be read in any order. Here's a quick selection of items from the table of contents:

1.19  Validating an Email Address
3.7   Converting Between Time Zones
4.9   Sorting an Array by Frequency of Appearance
5.11  Choosing Randomly from a Weighted List
9.6   Automatically Loading Libraries as Needed
11.13 Extracting All the URLs from an HTML Document
14.5  Sending Mail
Posted by bret at 04:48 PM | Comments (0)

October 01, 2008

Watir Status Update

I've been busy lately working on the next release of Watir, coming out later this month. It will be a combined Watir/FireWatir release. I discuss this work in detail in this podcast. Our work on supporting Firefox is drawing contributors from the community. This prompted me to write up guidelines on making contributions.

At WatirCraft, we are currently looking for customers, particularly those interested in a Watir-based framework.

One of the reasons that I've been posting here less is that I've been posting on twitter and on something I call my miniblog. I've also been frequenting the #watir IRC channel.

Posted by bret at 09:54 AM | Comments (1)