Search code examples
pythonqtsquish

Squish set application context to aut started by aut under test


In python, is it possible to set application context to the second gui which is invoked by the GUI under test.

Ex: We start an application called test1.exe using startApplication. Clicking a button in text1.exe GUI invokes another GUI application called test2.exe.

Now is it possible to set application context to test2.exe GUI?


Solution

  • Squish for Qt requires that the sub-process be started by squish_dir/bin/startaut.exe (then use attachToApplication()), squish_dir/bin/dllpreload.exe (automatic hookup), or have the built-in hook compiled into it.

    In some cases you may get away by doing the following (documented in Additional Setup for Hooking up Qt Sub-Processes on Windows Non-Invasively):

    • Rename test2.exe to test2_.exe
    • Copy squish_for_qt_dir/bin/dllpreload.exe into the same folder as test2_.exe and rename it to test2.exe.

    This way test1.exe will invoke test2.exe, which is now dllpreload.exe in "disguise", which will cause that dllpreload.exe to start test2_.exe.

    This approach will not work if test1.exe requires the process ID of test2.exe, or if test2.exe requires the process ID of its parent process, because in both cases that is the renamed dllpreload.exe. This will also not work if test1.exe and test2_.exe try to communicate with each other via their stdout, stderr, stdin streams (because dllpreload.exe does not set this up).