Web Testing for .NET Teams: WatiN or Watir?

I’ve noticed a pattern with several of my .NET clients who want to get into automated acceptance testing for web applications. They like the idea of WatiN because it would let them write tests in the same language as their production code. But then they notice that there’s much more documentation and apparently a much more active community around Watir. And that Ruby language looks interesting too. What to do?

I think there are good arguments for both. Here are the major pros and cons from my perspective…

WatiN

Pros Cons
  • Code and test in the same language (e.g. C#)
    • No need to learn a new language (i.e. Ruby)
    • No need to support another language
    • No need to hire people who know another language
  • Did I mention that you can write tests in C#?
  • IE only (though there’s a CTP for FireFox support)
  • Very limited documentation
  • More syntactic noise (more due to .NET than to WatiN itself; e.g. new Regex(“txtFoo$”) vs. /txtFoo$/)

Watir

Pros Cons
  • Very active community
  • Active ongoing development on Watir and related projects
  • Good support on the discussion list
  • Concise, clear syntax (more due to Ruby than to Watir itself)
  • Good documentation (though finding the current RDoc online can be difficult)
  • Works with Cucumber, my current favorite acceptance test tool
  • Supports multiple browsers (IE, Firefox, Safari, and soon Chrome and Opera)
  • Uses a language unfamiliar to .NET teams (that’s who we’re talking about here, remember)
  • Doesn’t directly work with .NET test frameworks (of course, you can wrap the Watir tests for use by MSTest or NUnit)

The Bottom Line

On balance, I think Watir is the better tool, has the better documentation, the most active community, and the best long-term prospects. But I understand the desire to standardize on C# or VB.NET for both production and test code. The long-term cost of adding another language to a product is not something to ignore.

Personally, I’ll continue to use and teach both tools with clients. When it comes to my own projects, however, I’ll be using and extending Watir, for all the reasons above and simply because I enjoy working with Ruby.

Which do you use and why?

Related Articles

Responses

  1. I use and like WatiN, but maybe thats not such a surprise 🙂
    Thanks for the article. Always good to know where things can be improved.

    Jeroen van Menen
    Lead dev WatiN

    btw I definitely also have love for watir