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

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

  • This thing is awesome

    by Francois Ward,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    While none of the places I worked for seemed interested in doing this (usually thinking unit tests were already enough "work"), I've been following it pretty closely, as a way to do full regression and integration testing on QA/UAT servers. Hope they keep up the good work until the day I do get to use it!

  • More than a test framework

    by Zhao jeason,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    I think this tool is more than a test framwork, we can use it to access Internet pages replaced HttpClient class.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT