Recommendations for unit testing wx applications on Windows

41 views
Skip to first unread message

cappy2112

unread,
Nov 22, 2009, 12:58:29 PM11/22/09
to wxPython-users


What unit-test tools are recommended for testing GUI apps on windows?
Are there any better-suited for wx apps?

Frank Niessink

unread,
Nov 22, 2009, 1:35:00 PM11/22/09
to wxpytho...@googlegroups.com
2009/11/22 cappy2112 <capp...@gmail.com>:

>
> What unit-test tools are recommended for testing GUI apps on windows?
> Are there any better-suited for wx apps?

In my experience, the unittest module included with the Python
standard library works just fine. The important part of unittesting
GUI applications is not to start the main loop, but you don't need a
specific tool for that.

Cheers, Frank

cappy2112

unread,
Nov 22, 2009, 1:55:39 PM11/22/09
to wxPython-users
Thanks Frank, that is an interesting idea.

If you don't start the main loop, how can you test the users input,
menu accesses, mouse clicks, etc?
These actions all cause event handlers to be called. Testing the event
generation/handling code is important too.

Frank Niessink

unread,
Nov 22, 2009, 2:06:54 PM11/22/09
to wxpytho...@googlegroups.com
2009/11/22 cappy2112 <capp...@gmail.com>:

>
> Thanks Frank, that is an interesting idea.
>
> If you don't start the main loop, how can you test the users input,
> menu accesses, mouse clicks, etc?
> These actions all cause event handlers to be called. Testing the event
> generation/handling code is important too.

In my experience testing that a button actually invokes its event
handler is not worth the effort. In our tests (for Task Coach, an open
source task manager developed in python and wxPython) we simply invoke
the event handler with a dummy event if needed.

See this article:
http://www.objectmentor.com/resources/articles/TheHumbleDialogBox.pdf

Cheers, Frank

Steven Sproat

unread,
Nov 22, 2009, 3:13:13 PM11/22/09
to wxpytho...@googlegroups.com
I've been using this "fakewidgets" package, see -
http://ginstrom.com/code/fakewidgets.html
It overrides the wx namespace, so when you load in your classes they're
loading in the fake, dummy widgets.

I also modified the original fakewidgets to add classes my program used
-- can be viewed at
http://bazaar.launchpad.net/~sproaty/whyteboard/development/files/head%3A/fakewidgets/

--
Steven Sproat, BSc
http://www.basicrpg.com/

Reply all
Reply to author
Forward
0 new messages