4 Jul 2008

Patterns for Automated Customer Testing with Watir (with example)

The reduced cycle times of Agile methods increases the need for Automated Customer Testing.

I want my Customer Tests to be interesting for the customer. As such, I generally prefer GUI driven testing (as I already have fast running Developer Tests). For web based systems I like to use Ruby, Watir and rSpec.

However, GUI driven tests are notorious for their brittleness. Using a first class scripting language like Ruby, goes some way to prevent this, but only if we write Good Code. I've found these patterns help me write clear tests with minimal duplication:

For example:
The online book seller "BigRiver" is implementing a WishList feature. Below is rSpec and Watir test for the following scenarios:
- The BigRiver WishList should let me add a book if I am logged in.