Testing and Spreadsheets: Automating Browsers with WatiN
Spreadsheets get used for a lot of things; in fact they get used for just about everything, which is part of the raison d’être of Resolver One. One of the slightly unusual uses for spreadsheets is for testing. The style of testing called FitNesse allows non-technical users to write acceptance tests for applications with tables of input data and expected output data. These test tables are ideally suited to being created using spreadsheets.
We haven’t heard of anyone using Resolver One for creating FitNesse test tables, but it is easy to integrate with external tools and libraries. One of the spreadsheets submitted in the last round of the spreadsheet challenge, and the second that we are looking at in our series, automates browsers for testing purposes.
Common tools for testing web applications include Selenium and Windmill. They allow you to automate browsers, simulate user actions and then check that the right results are displayed. WatiN is another tool for automating browsers and it comes in the form of a .NET library. Greg Bray has integrated this with Resolver One, allowing you to drive Internet Explorer from a spreadsheet table. His spreadsheet performs searches with Google, Bing and Yahoo and extracts the number of results from each search engine.
The screenshot below shows the results table after performing the search:
Bing seems to report rather a lot of results for “Resolver One”! This example application, which you can download from the Resolver Exchange, includes the WatiN binaries and documentation:
This is a simple example of how to use the new WatiN 2.0 library in Resolver One. WatiN can be used to automate testing of webpages in Internet Explorer, and version 2.0 has partial support for Google Chrome and Firefox.
You basically use WatiN to create a script of what you want to do on a webpage (ie: click, type, browse to…). This example takes a list of search terms and compares how many results are provided by Google, Bing, and Yahoo.
This is a simple task, but WatiN can be used for much more advanced automation on complex sites even including AJAX webpages. For a more complex example, see this link for an IronPython script that downloads a list of incoming and outgoing call data from the Vonage website.
The example would be a good base to build web application tests by creating a table of actions and a corresponding table of results. By hiding the code pane, or using the Resolver One Player available with version 1.6, you could even define the interactions in code and have customers specify the tests.
For more ideas for testing with Resolver One we suggest reading Creating Test Tables and browsing the Resolver Exchange.
Tags: automation, testing, watin


August 19th, 2009 at 5:06 pm
[...] to the Resolver One Spreadsheet Challenge, and the third spreadsheet we are looking at in this series of blog entries, is a spreadsheet application for Stock Trading and Portfolio Analysis. It is the creation of the [...]