[wingide-users] Set 'main' file / some info on unit testing GUIs
support at wingware.com
Thu Mar 19 09:11:22 MDT 2009
Michael Hipp wrote:
> Hard to say as I probably don't have a good concept of what you're
> imagining. An easy simple click-one-button to launch in different
> configuration could be really helpful. But if it takes much work to set
> it up it will likely lay fallow. The mental process tends toward always
> thinking of setting up something quick and dirty so don't put a lot of
> effort into it for this quick test I need to run and only realize hours
> or days later how much actual work I've put into it. i.e. Too easy to
> avoid things where the effort is front loaded.
A valid point, thanks.
>> As an aside I'll just note that we do our GUI testing also via the unit
>> testing tool and I don't think unit testing has to necessarily omit
>> gui testing code.
> As a late convert to unit testing I'm the least qualified to write about
> it. But ...
> I'm still looking for a useful GUI testing tool and part of me seems
> comforted to think that such a thing is near impossible to exist.
> That's a roundabout way of saying I'd like to hear more.
We use GTK although I don't think wx would preclude setting up the same
sorts of test support we have internally. Basically, we wrote a way to put
up the app and tear it down and a bunch of utilities for finding windows and
widgets, setting focus, sending key or click events, waiting for certain
conditions to be true while giving time to the GUI, etc.
Then a typical test looks something like this simplified semi-fictitious
example (which is a method of a class that descends from the common class
that has automatic setup and tear-down code):
tmploc = self.CreateTmpDir()
projloc = tmploc.Child('a.wpr')
proj = self.NewProject(None)
lambda: testutils.FindWindowByTitle('Save Project As') is None)
win = testutils.FindWindowByTitle('Save Project As')
testutils.SendKeys(win, projloc.fName, alt_prefix=None, ctrl_prefix=None)
I suspect you're pretty much stuck w/ writing analogous utilities, but
from what you described you may already have them and it may just be
a question of packaging your tests as unit tests.
Don't know if this is helpful or not...
Wingware | Python IDE
Advancing Software Development
More information about the wingide-users