Going further

As you can see, the basic concepts behind automated GUI testing are not that difficult. However, I have some bad news for you. Gui testing is more complex then it appears after reading this tutorial. The one object - one window pattern is not followed even for some basic controls. One of them is toolbar. If you examine with WinSpy any application containing a toolbar, you will see that WinSpy sees only one window - the toolbar. Buttons on the toolbar are not separate windows. So you can't work with a toolbar in a way you did with calculator. We need to use some more sophisticated mechanisms.

Also, some types of applications are seen by the system as one window with no children. Java applications behave this way. No matter how many controls they have, they are seen as single window by Win32 (and, what follows, by WinSpy).

But there is still much interesting stuff you can do with Win32::GuiTest perl module.

What you got in this tutorial should be enough to do simple test scripts. However, if you plan to perform some more serious testing of applications, which are more complex than calculator, sooner or later the knowledge from the first part of this tutorial will be insufficient. Have a look at the functions' descriptions in the appendix.

The next part of this tutorial addresses dealing with advanced controls. It is significantly more advanced then the first part of the tutorial. You don't have to understand it in order to be able to do useful/advanced automation using Win32::GuiTest. However, it does address some issues, which may appear useful, when you deal with custom, non-standard controls. It also explains in more detail, how Windows controls work. Although it is not going to answer all your questions, it should give you a background for finding a solution to some problems you will encounter. In order to understand the next part of the tutorial you should have some knowledge (or at least a will to understand) of C, perl (of course) and perl internals. I will do my best to make it simple, but if you have some programming skills it will definitely help.

Fasten your sitbelts...