Geeks With Blogs

  • CaffeinatedTwit It would also be nice if google added some sarcasm filters about 2401 days ago
  • CaffeinatedTwit "Singletons are evil" = 739,000 results..."Singletons are aewsome" = 384,000 results...Evil clearly wins. about 2401 days ago
  • CaffeinatedTwit @mpool Noob! You obviously haven't had enough practice when it comes to drinking at lunch. about 2413 days ago
  • CaffeinatedTwit Spent lunch at Borders working on a blog post for Monday. about 2413 days ago
  • CaffeinatedTwit I'm still in the mode where I'm trying to minimize the refactoring until I get the mocking framework more deeply integrated into our process about 2413 days ago
  • CaffeinatedTwit Just discovered the outref option in rhino.mocks. Opted to use that instead of refactoring legacy code to a return object this time. about 2413 days ago
  • CaffeinatedTwit First time posting on twitter in a couple of weeks and the update fails. Good to know things haven't changed much. about 2414 days ago
  • CaffeinatedTwit Overheard: Is there anyone I can talk to there who is having a better day than you are? (coworker to DMV worker) about 2414 days ago
  • CaffeinatedTwit Installing the final version of R# 4.0. Been getting lots of errors with the pre-release version I am using, so hopefully this will help. about 2422 days ago

Caffeinated Coder A Grande, Triple Shot, Non-Fat Core Dump by Russell Ball

Several weeks ago I used WatiN (pronounced as What-in) to create a suite of automated GUI tests for an old internal ASP application that we were upgrading. Inspired by the popular ruby testing tool Watir, WatiN is an open source .NET wrapper around the Internet Explorer that you can reference in your test project and use to get access to all of the HTML elements on a web page. I was surpised by how easy it was to simulate a user typing text and clicking buttons and then check to see if the result page contained certain text. The following popular example code demonstrates how you would test a google search for WatiN.

public void SearchForWatiNOnGoogle()
 using (IE ie = new IE(""))

Today, I experimented with the IEDevToolbar for the first time and suddenly WatiN became much more compelling. By using the "Select Element By Click" feature under the Find menu in the IEDevToolbar, you can simply click on an element on a web page and instantly see all of its properties. Since most popular commercial sites have very large, chaotic source files with elements that don't always have ID or Name properties, this feature is indispensible when trying to figure out how to programmatically interact with the page. Below shows how I was able to retrieve the Starbucks stock price from CNN and create a test to ensure that it was above an acceptable amount.

Since the stock retrieval button on was an image that had no name or ID, I used the Find.ByCustom() method to retrieve and click on the button using the className attribute.

This task would be even easier using the WatiN Test Recorder, which you can see in this flash demo. However, I still haven't been able to get the recorder to work properly on my Vista machine so I'm not a big fan of this tool yet. I will definitely keep an eye out for future versions though.

Posted on Friday, August 31, 2007 9:16 PM Software Development Practices , Tools | Back to top

Comments on this post: WatiN and the IEDevToolbar: The Dynamic Duo of Automated Web Testing

# re: WatiN and the IEDevToolbar: The Dynamic Duo of Automated Web Testing
Requesting Gravatar...
Thanks for the very useful post.

For complex web pages (where visual recording is important), you can also use the free iMacros for Firefox/IE addons from
They are very easy to use.
Left by Sandra W. on Sep 02, 2007 2:10 AM

# re: WatiN and the IEDevToolbar: The Dynamic Duo of Automated Web Testing
Requesting Gravatar...
Nice article. The WatiN test recorder works pretty nicely for me, other than a few weird timing issues. It's definitely a good way to get a shell created for tests.

Since you are planning to devote time to open source projects, maybe you can help out with the ajax wait methods. I had to do some crazy stuff to get it to recognize when my span no longer has text.

ie.Span(Find.ById("spanName")).WaitUntil(new Attribute("OuterHtml", "<SPAN id=spanName></SPAN>"));

of course, i do tend to like to make things difficult
Left by marshal on Sep 07, 2007 4:31 PM

# re: WatiN and the IEDevToolbar: The Dynamic Duo of Automated Web Testing
Requesting Gravatar...
Check out Record Application.

It combines a recorder and a DOM viewer like IEDevToolbar but they interact together.

Actually a tool called IEMon which I think is the ancestor of IEDevToolbar, inspired us to add our DOM viewer to our product.
Left by ftorres on Oct 13, 2007 12:40 PM

Your comment:
 (will show your gravatar)

Copyright © Russell Ball | Powered by: | Join free