When trying to start an AUT with the toolkit set to Qt and 'Hook into sub-processes launched by the application' set, I have to launch the application (which is a windows application that launches a process to set up a Qt window) using the dllpreload.exe provided by Squish to attach to the Qt window. Doing this doesn't show the windows console and just launches the Qt window. This hooks into Qt successfully...
When setting testSettings.setWrappersForApplication("application", ("Windows", "Qt"))
or testSettings.setWrappersForApplication("application", ("Windows"))
, it fails to hook onto the Qt window as a Qt window and doesn't recognise the Qt components.
Is there anyway for squish to recognise the windows console as 'Windows' and the Qt window as 'Qt'?
The use case of hooking into a Qt application which is a subprocess of a native Windows application is documented in a Knowledge Base article. The easiest approach to this is:
myqtapp.exe
to the same name but add an underscore at the end, i.e. myqtapp_.exe
.dllpreload.exe
program shipped with Squish to myqtapp.exe
.That way, your Windows program will unknowingly call dllpreload.exe
, which will then deduce the file name of the original application from its own file name (it'll just add an underscore).
The dllpreload.exe
program is not a perfect proxy though, so it may be that your Windows application notices that it's not interacting with the real AUT. In that case, it may be easier to modify the Windows application so that it explicitly prepends dllpreload.exe
to the command line which is used to start the Qt application.
You could do this conditionally such that it's only done when the Windows application is launched via Squish. This situation can be detected by testing for the existence of the SQUISH_PREFIX
environment variable.