Richard Lawrence

On making software teams happier and more productive

Web Testing for .NET Teams: WatiN or Watir?

3 comments

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?

Written by Richard

January 19th, 2009 at 8:49 pm

Tagged with , , , , , ,

3 Responses to 'Web Testing for .NET Teams: WatiN or Watir?'

Subscribe to comments with RSS or TrackBack to 'Web Testing for .NET Teams: WatiN or Watir?'.

  1. Good post… Watir support for Chrome has come up now. Check out http://code.google.com/p/chrome-watir for more info…

    One more advantage of watir which I found is because of Ruby building abstractions and DSLs for testing is pretty easy and good looking ;)

    Regards,
    Sai

    Sai

    20 Jan 09 at 10:33 pm

  2. 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

    Jeroen van Menen

    22 Jan 09 at 1:57 am

  3. [...] Richard Lawrence provides a comparison between WatiN and WatiR pros and cons in this article. [...]

Leave a Reply