I have seen several blog posts recently about WATIR. While the tool appears to be great (haven’t tested it yet, but I’m positively biased toward anything Ruby) something bothered me all along – shouldn’t we write integration tests on the web server side, not “scripts” like this on the client side?

While some might say that WATIR helps with Web UI testing, this “UI testing” does nothing more than to ultimately invoke “business logic” functionality on your server. Every click on a button or a hyper-link will either lead to a page load (via HTTP GET) or post some data (via HTTP POST). You can do this on the server with good integration tests.

Note that unit tests do not apply here – we are testing application behavior as it is used by the users (even if simulated ones), not small pieces of functionality on a micro-level (of a class or a method).

That said, I can still see two cases where you probably must use WATIR or an equivalent tool:

  1. Your server side implementation does not allow an easy way to write integration tests; for example, Ruby On Rails provides quite a good base for the server side integration tests*, but I have not seen such a deep support in ASP.NET
  2. You want to make sure that there are no issues on the client side after the resulting HTML gets processed by the Internet Explorer (WATIR only works with Internet Explorer for the moment); if all you cared about was the correct HTML output you can easily get by with a server side integration test
*There’s an excellent recipe (number 43, Testing Across Multiple Controllers) in the Rails Recipes book on how to write integration tests for Ruby On Rails apps.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
0 Comments