From: Michael D. Crawford (crawford_at_[hidden])
Date: 2001-04-03 01:55:43
While different from unit testing, you can do robotic GUI testing with
something like virtual user for the Mac OS. It is free-as-in-beer from Apple:
You can write scripts that tell the mouse to hover over buttons that you
denote by name or a numeric ID and command the button to click, hold down for
a period of time, drag and so on. You can also select menu items by moving
the mouse, type keystrokes and so on. The menu items can be referenced by
position in the menu or the text of the menu item.
Virtual User provides a scripting language so you can define subroutines that
will, say, click buttons in different ways given its title and parameters like
the time to hold the button down, maybe a boolean flag as to whether to drag
the mouse off the button before letting go, so (with a lot of work) you can
write fairly complete tests for complex applications. If you had a simple
testbed app that had a window with one of each kind of button your framework
provides, it wouldn't be hard to run the whole thing through a test script
each time you build it.
Virtual user is great, and I highly recommend you adopt it if you are
responsible for a Mac OS GUI application, but it is only available for the Mac
I have it in mind to write some kind of a test harness like this, only it will
be open source and cross-platform. It will use scripts interpreted in Python
that will communicate with a driver stub that will know about a particular GUI
framework that you'd link into your application.
One will use some manner of RPC protocol to communicate with the stub and you
could use different scripting languages than python by writing another front
end. Python's nice because of the way you can easily extend it with native
code, but that can be done for almost any language.
With a variety of front ends a variety of driver stubs then any GUI program in
any language on any platform could be tested from any scripting language; the
scripts that do the driving could be run on a separate machine over a lan, and
one could control a number of separate machines under test. When I worked at
Apple, I saw hundreds of machines in the QA labs all running virtual user
scripts all day and night.
Unfortunately, I have it in mind to write a lot of things and I'm not likely
to do something like this anytime soon. If I ever do it will be of limited
utility at first to test my own applications, but I would eventually release it.
But _you_ can write it if you want, the idea's yours for the taking and in the
meantime if your GUI library is cross-platform you can at least test it on the
Mac with Virtual User and exercise the cross-platform components of your code.
There are a number of commercial tools available on other platforms for this
sort of thing from various vendors, some of which are very expensive. Virtual
User is the only one I know of that's freeware.
-- Michael D. Crawford GoingWare Inc. - Expert Software Development and Consulting http://www.goingware.com/ crawford_at_[hidden] Tilting at Windmills for a Better Tomorrow.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk