Wednesday 17 December 2008

Web Application Testing In .NET

Recently I had the opportunity to use the open source software tool, WatiN (Web Application Testing in .NET), in a commercial environment. It is inspired by the similar Watir (Web Application Testing in Ruby). Initially (about a couple of years ago) I dabbled in Watir after being alerted to its existence by my friend, Mark Hudson. Also, it gave me an excuse to play around with Ruby a bit, Ruby being the sleek new kid on the block at the time.

As it happens, although WatiN and Watir are web testing frameworks,  they can be used for automating browser operations - text entry, mouse clicks, navigation, etc., independently of any testing. So you could use them to log into Internet banking sites. Well, that's becoming increasingly impossible with the rise of two-factor authentication schemes, such as Barclays' PINsentry system, that additionally use card readers.

What else do we need for testing our web applications with WatiN?

First, we should note that WatiN is for testing the UI as such, not for testing the application as a whole. Depending on how the web application is structured we can use standard test-driven development for the rest of the application.

The other tools I used in combination with WatiN were:

WatiN Test Recorder is helpful for generating rough starter code from your mouse clicks and keystrokes and giving you a feel for how to use the WatiN API.

The IE Developer Toolbar is useful for helping you identify the HTML control identifiers. (Currently WatiN requires Internet Explorer but Firefox support is in beta.)

NUnit is the framework for running the tests in C# or VB .NET.

WatiN itself has recently been upgraded to include .NET 3.5 and C# 3.0  language features - LINQ and lambda expressions. It has an excellent and active mailing list for technical support.

I will discuss WatiN in more detail in a subsequent post.

No comments:

Post a Comment