Thursday, January 28, 2010

Four tool approaches to automated web UI tests

[This was originally posted at http://timstall.dotnetdevelopersjournal.com/four_tool_approaches_to_automated_web_ui_tests.htm]

 We all know that in the ideal world, our web apps would have "sufficient" automated tests. But how? I'm not an expert here, but I've come across four general strategies:
DescriptionExamplePROCON
Send web requests, and then parse the corresponding response.MSTest WebTests
  • Handles simple postbacks very well
  • Independent of server technology (you don't care if it's ASPX, JSP, or PHP providing the responses back)
  • Lots of Visual Studio support
  • Dies on Ajax because it can't parse JavaScript
  • Requires a ton of parsing logic. Granted, there are free Html parsers to help with this.
  • Requires the expensive version of Visual Studio for Testers, so not everyone can run on their machines unless management pays $$$ for the licenses.
Directly tap into the ASPX pipeline (I'm no expert here, but to my limited knowledge, it seemed different than merely the request-response model).NUnitAsp (but this was officially ended)
  • Minimizes the parsing
  • Free
  • Still trouble with JavaScript (if memory serves me right).
Recording and playing back the mouse and keyboard movementsDon't know offhand, but I've heard of them with COM+
  • Tests actual UI layout (is the textbox 10 pixels below the button).
  • Very brittle with browsers, especially because browsers can resize
Run the browser in an automated script.WatiN
  • Because it runs the browser itself, it can handle whatever the browser handles, like JavaScript. This is huge in today's Ajax world.
  • Free! This is great when you want the entire team to run it on their local machines.
  • Active community supporting it
  • (I believe, but may be wrong) that because it runs the browser, it's limited to just IE.

 

Personally, I've seen the best luck with WatiN. Especially in the Ajax age, automated tests need to run JavaScript. I also find that to get a team to adopt a new tool, it's invaluable to let them run it themselves (i.e. anyone can download the open-source tool and run it with management paying $$$ for a license), and to provide tutorials (i.e. WatiN has an active community).

 

No comments:

Post a Comment