Still working on automated testing of a wxPython application (called Transana).
I have a method that looks like this:
def doImportDatabase(self, xmlFPath):
···
#
# This clicks on the Import Database menu, which opens up
# a modal dialog
#
self.widgetManip.chooseMenuItem(MenuSetup.MENU_TOOLS_IMPORT_DATABASE)
#
# This types a file name in the modal dialog, and clicks the OK button
#
importWndManip = self.xmlImportWndManip()
importWndManip.doTypeXMLFileName(xmlFPath)
importWndManip.doOK()
The problem I'm having is that as soon as the menu item is clicked, the modal dialog takes over, and the last three lines (entering the file name and clicking OK) do not happen
until I have manually clicked on the OK button to close the dialog box.
I tried running the application in a separate thread, than doImportDatabase, like this:
class TransanaInSeparateThread(threading.Thread):
def __init__(self, app):
threading.Thread.__init__(self)
self.app = app
def run(self):
self.app.MainLoop()
TransanaInSeparateThread(app).start()
... Then go about building the test harness and invoking doImportDatabase().
But to no avail. Does anyone have ideas for how I could get around this problem?
Thx
----
Alain Désilets, MASc
Agent de recherches/Research Officer
Institut de technologie de l'information du CNRC /
NRC Institute for Information Technology
alain.desilets@nrc-cnrc.gc.ca
Tél/Tel (613) 990-2813
Facsimile/télécopieur: (613) 952-7151
Conseil national de recherches Canada, M50, 1200 chemin Montréal,
Ottawa (Ontario) K1A 0R6
National Research Council Canada, M50, 1200 Montreal Rd., Ottawa, ON
K1A 0R6
Gouvernement du Canada | Government of Canada