BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News WatiN: Web Application Testing in .NET

WatiN: Web Application Testing in .NET

This item in japanese

Bookmarks

WatiN is an open-source library for automating web browsers using .NET. WatiN, inspired by the popular Ruby-based Watir project, facilitates automated testing of web applications through browser interaction. WatiN is written in C#, but tests can be expressed in .NET language. Windows is the only supported platform.

Version 1.0 was feature-rich in comparison to most other .NET solutions and moderately popular as a user interface and user acceptance testing tool, but without customization, it only supported automating Internet Explorer. Though still in development, version 2.0 of WatiN supports automating IE and FireFox 2.0 & 3.0. The new community technology preview, WatiN 2.0 CTP 3, was released on February 11th.

CTP 3 is focused on increasing support for FireFox and includes the following changes:

  • Implemented support on Mozilla.Frame to get access to elements inside the document of a Frame
  • Implemented support on Mozilla.Frame to get access to elements inside the document of an IFrame
  • Implemented Eval on Mozilla.Document (= FireFox and Frame) and added to the IFrame interface
  • Fixed bug that caused Form.Submit not to wait for a possible postback and page load in some circumstances

WatiN relies on browser interaction and uses DOM manipulation and verification to assert conditions, but WatiN 2.0 has an abstraction layer that facilitates writing cross-browser tests. The following code sample shows a simple example that searches for WatiN through Google and asserts that "WatiN" is included in the results. The IE test and FireFox test could easily be refactored to a single test that works against either browser.

Because writing WatiN tests by hand can be tedious, another open-source project exists to record WatiN tests in a browser. WatiN Test Recorder does not have a new release available, but version 2.0 is currently in development and promises major enhancements.

Rate this Article

Adoption
Style

BT