[TIP] Functional Testing of Desktop Applications
fuzzyman at voidspace.org.uk
Sun Mar 4 13:44:46 PST 2007
Atul Varma wrote:
> At Humanized, for the functional tests of our Enso products
> (www.humanized.com <http://www.humanized.com>), we use a modified
> version of unittest for our test framework and use various automation
> tools to perform the actual testing.
You guys do some interesting stuff. I keep meaning to try them out. :-)
> One of the useful architectural modifications we've made to unittest's
> standard framework is the notion of a "test environment", which allows
> us to run the same tests in different kinds of contexts. Running a
> test in an unfrozen Python environment, for instance, allows us to get
> an idea of whether a functional test works in general, without having
> to go through our time-consuming py2exe'd build process to generate a
> frozen version of the product, but the test environment architecture
> allows us to run the same test using a frozen version on our
> continuous integration machines.
Right. It sounds similar to some of the things we do.
We use MSBuild to do a full build at the start of our test run (a full
run of all our tests takes an hour and a half, so the build time is
trivial compared to that). We *do* have a separate executable (created
as part of the build process) so that we can run individual test files
rather than launch our application.
> In general, as much criticism as unittest has received for its
> complexity, we've found it to be pretty useful for functional testing;
> in fact, all of our tests--unit tests, functional tests, and manual
> tests--use the unittest framework, which makes collecting the test
> results easier for us.
I've never understood the unittest complexity issue - it seems
straightforward to me ?? Perhaps it is a documentation issue.
> As for the automation tools, currently I believe we use Mayukh Bose's
> IEController  and pyAA . The latter is particularly useful to
> automate interactions with apps that don't use Microsoft's standard
> widgets, such as Firefox (which draws its own menus and other controls).
Right. pyAA is another tool that I haven't seen before which looks very
We hit the win32 api directly for automation - sending key events, mouse
up and down, mouse move etc.
We then tend to check the controls directly to see if they have the
required contents / state.
As sending the events and then waiting for the results is asynchronous,
we use patterns like 'wait for condition' and event waiters.
If I was to implement a functional test framework for wxPython I would
be sorely tempted to go down a similar route...
The automation tools pointed to so far (pywinauto, pyAA) might save
're-inventing the wheel' though.
> - Atul
>  http://www.mayukhbose.com/python/IEC
>  http://www.cs.unc.edu/~parente/tech/tr09.shtml
> On 3/4/07, *Michael Foord* <fuzzyman at voidspace.org.uk
> <mailto:fuzzyman at voidspace.org.uk>> wrote:
> Lawrence Oluyede wrote:
> >> Do others on this list do functional testing for desktop
> >> and what frameworks do you use ?
> > It's not exactly a test framework but an automation tool and I
> > used by myself but I was nicely impressed when I attended the talk
> > about pywinauto held by Mark McMahon in last year's EuroPython.
> > Maybe it can help you guys automate the testing of user interfaces:
> > http://pywinauto.pbwiki.com/
> Thanks Lawrence.
> For our IronPython project we have built our own test framework (for
> both unit and functional tests) on top of unittest.
> I'm looking to create a desktop application of my own (in a few months
> once this book is finally done with) and will *probably* use wxPython.
> I'm interested in what other Python programmers are using to
> functionally test desktop applications - particularly wxPython apps
> (although QT is pretty nice and worth considering).
> Pywinauto looks very interesting - hmmm... Their demo on the homepage
> looks good.
> > HTH
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> <mailto:testing-in-python at lists.idyll.org>
More information about the testing-in-python