Web Application Testing: WatiN

27 03 2008

Testing is part of our lifes (or should be) as it is one important task during developmant phase. Unit tests have automated the validation of the business and data access layers, but the interface layer has always been a pain in the neck do implement with automated processes.

The Watin tool/framework appears as an interesting way of building tests in .net language.
Here is a feature list from the site:

  • Automates all major HTML elements
  • Find elements by multiple attributes
  • Supports AJAX website testing
  • Supports frames (cross domain) and iframes
  • Supports popup dialogs like alert, confirm, login etc..
  • Supports HTML dialogs (modal and modeless)
  • Supports creating screenshots of webpages
  • Has a basic (extensible) logging mechanism
  • Works with Internet Explorer 6, 7, 8 beta 1 and FireFox 2
  • Developed in C#
  • Licensed under the Apache License 2.0
  • And.. If you miss some feature, you can add it yourself because it is open source!

A snapshot of a simple test in c#:

[Test]
public void SearchForWatiNOnGoogle()
{
 using (IE ie = new IE(“http://www.google.com”))
 {
  ie.TextField(Find.ByName(“q”)).TypeText(“WatiN”);
  ie.Button(Find.ByName(“btnG”)).Click();
  
  Assert.IsTrue(ie.ContainsText(“WatiN”));
 }
}

I haven´t tested this yet, but sure sounds interesting for everybody working with web interfaces.

Oh, BTW, this is opensource and c#!

Advertisements

Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: