Automating UI tests (was Re: Art of Unit Testing)

Boudewijn Rempt boudewijn at tryllian.com
Mon Aug 27 04:44:38 EDT 2001


Mike Clarkson wrote:

> 
> It's probably easier than you think: look at the Tk 'event' command.
> It can deliver an arbitrary keyboard mouse or virtual event to any Tk
> widget.
> 
> In your UI code,  setup a dictionary which contains the widgets
> that you want to test by sending events to, so that you can refer to
> then in the testng code. Then in the testing code, use the event
> command to send thngs like <Button-1> events to those widgets.
> 
> Note that if you are testing Dialogs (popped up windows with a grab)
> you probably have to use the Tk 'after' command to queue up the events
> before instantiating the Dialog.
> 
> Mike.

In PyQt, I use a a small extra framework to test whether signals arrive.
This way, I can check whether the signals that the underlying logic sends
fit what the GUI will expect. That can be extended to send signals to the 
GUI and check whether the GUI components do the right thing on getting them 
- it's a bit comparable to what you describe, but still no substitute for 
user tests, I'm afraid.

-- 
Boudewijn | http://www.valdyas.org



More information about the Python-list mailing list