Thursday, December 14, 2006

IE automation

Lately had to work on based workflows. Awfully, painful having to fill in all that test data over several pages just to get to say page 8/10 to do some basic unit testing. Thanks to DHTML/JavaScript, No Nunits/NunitAsp to rescue here!

Being as mind buggering as that, i had following options:

  1. Don't do any unit testing but loose friends and eventually job.
  2. Do unit testing but loose sanity.
  3. Quit and find another job. but how far could i run?
  4. Find some "free" IE automation tool or GUI testing tool which allows easy recording and playing back browser sessions. Preferably via nunit but beggars can't be choosers so anything else will do, just make it "quick and easy".
  5. If not found, write one. Like it, ride my hobby horse and charge on to windmills.
Options 1-3: are out of question as i am lazy.
Option 2 :If money can't buy you friends, unit testing ones own code definitely can. hmm... what a life to live.
Option 4: sounded promising and it indeed was. There is Watir, "Web Application Testing in Ruby" and some such in perl too. Then there is Selenium. They are pretty good frameworks and here's some comparison

oh! and now there is Watij (pronounced wattage not Wat-is-e)

while oogling and googling these things it became clear that it can't be that difficult to write a tool to scratch my itch exactly as i want it.

It is as simple as hosting a browser, hook up a few change event handler for recording and playback is just is even easier. How difficult can it be to find a unique identifier for whatever html element has been clicked, get its value and save it say an xml file. To play the session back, read each element id from xml and do document.all(id) and then call corresponding set value. If the tool is meant to help me nunit test my code, i can surely put a silly id on everything that has a some interesting behaviour. Guess pop-ups will a hassle but perhaps some nifty autoit script can come to help.

let see ...

No comments: