How do you write test suites for GUI components?

David Bolen db3l at fitlinxx.com
Fri Jun 11 17:34:19 EDT 2004


j_mckitrick at bigfoot.com (j_mckitrick) writes:

> I guess mine will be much simpler, then.  :-)
> 
> I have pygtk guis tha are the interface to my application.  If test
> suites are so important, how can they be applied to modules that just
> run dialogs or windows?

When testing a GUI, IMHO what you are testing is that actions taken
against that GUI turn into appropriate operations on your underlying
application data model, as well as that the appropriate portion of
your data model is going to be reflected in the presentation of the
GUI.

So, do those dialogs or windows interact with your business logic?
That is, when a user manipulates controls on those dialogs or windows,
what sort of actions are taken on the data managed by the application.
That's what you want to test is occurring properly.

Or, do those dialogs or windows display data that is obtained from
your business logic?  That's what you want to test will be displayed
properly.

By separating out the act of translating actions on a GUI control into
business logic actions, versus the management of any data that
underlies a GUI control (the text for a static text box, or the label
on a button), versus the drawing of the control itself and interaction
with external events like mouse presses, you can go a long way towards
testing a lot of how the GUI operates.  Combine that with tests to
ensure that your business layer operates properly (sans GUI), and
you've got some reasonable coverage.

-- David



More information about the Python-list mailing list