Friday, April 06, 2007

GUI test automation of web applications

In course of my past projects, I've multiple times tried to establish effective GUI test automation and for some reasons my attempts always failed. It does not mean that automation was not created at all, but very low effectiveness for significant effort. One of the interesting side effect, that I've seen was that complex GUI test automation usually require someone's attention - you cannot just add it into task scheduler at 2 o'clock in the night, and get result in the morning.
I've tried it with the different people (sometime I even assign good developers into it), but still they encountered enormous amount of technical problems. So I've realized that its not the fault of the people, but rather fault of software. No matter whenever you are using cheap AutomatedQA TestComplete or expensive Mercury WinRunner/QTP, the tools are huge, pretend to do everything and but actually did each task with significant limitations. The worst thing about this is that if you encounter a problem, neither google nor support usually cannot help you.
Recently I was thinking about problem of automated periodic posting of some information on various web-sites. We've tried to automate it using TestComplete, but stability and speed was far from perfect. In fact it refuses to work through TaskScheduler at all, and you will need someone, who will manually run corresponding .bat file from time to time. In order to change this situation, I've start thinking about tools like NUnitASP. It looks lightweight and cool, but does not suite my needs, because of the nature of my task. Usually such type of sites are not really happy when someone is using robot to post data there, so they actively resisting it. I need an ability to click on links and fill fields in the actual browser.
So I was thinking - if I need a real browser to automate this task - why cannot I incorporate one in my C# program? Quick search shows me one good sample on codeproject. I've downloaded it and tweaked according to my needs and it works! I've running this on task scheduler completely unattended, and just getting results from there.
I'm going to post technical details and some point of time later, when I will polish them, but the idea of this post is very simple: if you need GUI test automation - consider writing your own tool for this. Of cause it is not free, and you will have to fight with non-trivial MS implementation of DOM, but this is the only thing you will have to fight - your own automation code will be very small and lightweight (mine is less than 300 lines now :)

4 comments:

Anonymous said...

I suggest you to take a look at Watir , people seem to be very happy with it.

Andrew Zaikin said...

That's pretty much the same thing :) It's good to know that someone already did something in this field. My own immediate concerns are:
1. Ruby syntax is a bit cryptic for me - I need some time to get used to it
2. I can see that the latest version is almost 2 years ago, which make me a bit nervous. As any other company MS is polishing their IE API, and sometimes things that works in one version of IE, does not work with another. If I would choose open source product, I would prefer to have one with strong community behind it :)

Andrew Zaikin said...

Anuway, I will find some time and give it a try :)

Anonymous said...

Well, you can help Watir project and send them fixes, so that their code is up to date :-)

I believe, you only need to use a subset of Ruby syntax for the purposes of unit-testing, which wouldn't be that cryptic. And eventually you'd get used to some more complex syntactic structures.