Jun 27, 2010

AutoIt - GUI Software automation script language

It is always hard to test GUI applications more than command line applications. One of the reason is GUI usually take inputs from mouse device and it is hard to simulate. There are several other reason though, I am trying to focus more on AutoIt: http://www.autoitscript.com/autoit3/index.shtmlAutoIt is a script language as far as I understand. Before I find AutoIt, I was trying to use Windows API "SendMessage" to mimic mouse click or keyboard short-cut: for example, SendMessage( hwnd, WM_KEYDOWN, xxx, xxx ). I found a utility to do this, SendMsg: http://www.maxoutput.com/SendMsg.html

I soon found it is very hard to find a right window handler and to find a right windows message even with Spy++.

At first time when I found AutoIt, I didn't expect something more than AutoMouse like simple features. My expectation was got suddenly raised after I read an sample example about notepad. It was a reliable script language rather than just sending some Windows messages.

Here is an simple example from its website:
Run("notepad.exe")
WinWaitActive("Untitled - Notepad")
Send("This is some text.")
; from http://www.autoitscript.com/autoit3/docs/tutorials/notepad/notepad.htm
We can also send keyboard short-cut messages:
Send("!f") ; Alt+f
Send("^s") ; Ctrl+s
Send("{ENTER}") ; Enter
I haven't seen mouse input functions yet. But there must be someway to do it; I will figure it later.

I think this utility can save lot of time for testing GUI applications.

No comments: