You can never run too many tests, especially when it comes to making sure your website is working properly in every web browser. But with a variety of browsers to test in, making sure everything is running smoothly takes time. That’s where Watir (pronounced “water”) comes in.
Watir is a set of open source Ruby libraries for automating web browsers to crawl and test your site. Watir essentially “drives” a web browser the same way your visitors would — clicking links, filling in forms, pressing buttons and so on. Because everything is automated you can test your site thoroughly and quickly.
Opera’s effort, dubbed OperaWatir, is the latest addition to the Watir test suite and joins the tools already available for Internet Explorer, Firefox and WebKit-based browsers. If you’re already using Watir for writing test suites (and you should be if you’re not) OperaWatir means that you can now test across all major browsers.
If you’ve never used Watir before, the Opera Dev Center has a nice tutorial on writing Watir tests tailored to your site. Opera’s tutorial walks you through the Ruby code necessary to automate common actions like clicking buttons, issuing keyboard commands and how to use the
sleep command to handle Ajax refreshes.
The second part of Opera’s announcement is OperaDriver, the backend of OperaWatir that communicates with the Opera browser. While OperaWatir is written in Ruby, OperaDriver is written in Java, and it allows developers to create automated tests using the Java-based JUnit testing framework. If you’re not a fan of Ruby, OperaDriver can do the same things using Java.