Closed rasjani closed 7 years ago
Just renaming/copying testability.dll to qttestability.dll will fail as the -testability handler tries to resolve symbol qt_testability_init which isn't found in cutedriver side.
Windows testing has been really low priority currently and we mainly use this on linux environment.
One way you could try to load testability is to add testability interface to main.cpp
#include "testabilityinterface.h"
and load plugin manually:
// Testability plugin handling for cuTeDriver
TestabilityInterface *testabilityInterface;
if (loadTestability == true) {
// Activate testability plugin if exists
QString testabilityPluginPostfix = ".so";
QString testabilityPlugin = "testability/libtestability";
testabilityPlugin = QLibraryInfo::location(QLibraryInfo::PluginsPath) + QDir::separator() +
testabilityPlugin + testabilityPluginPostfix;
QPluginLoader loader(testabilityPlugin.toLatin1().data());
QObject *plugin = loader.instance();
testabilityInterface = qobject_cast<TestabilityInterface *>(plugin);
if (testabilityInterface) {
testabilityInterface->Initialize();
}
}
What Qt version you are using on windows, I could see if I have some time to debug this myself
Using Qt5.6.2 LTS .. And yeah, i was aware how to alternatively load the plugin - but at the time of filing the issue, i still had some troubles to actually load it - or alternatively the issue was probably due to :name not matching the process name to attach to ..
Anyway, i got things working now. So the issue can be narrowed down to the fact that -testability flag passed to a application is already "reserved" as there's a argument handler in qtbase/src/gui/kernel/qguiapplication.cpp.
See: http://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/kernel/qguiapplication.cpp#n1385 http://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/kernel/qguiapplication.cpp#n1456
Maybe agent plugin from cutedriver could be drop-in replacement for this autopilot-qt so that there would be no need to instrument the sut binaries if cutedriver is used ?
Drop-in replacement could be good approach. I'll try to check if I can manage to get time to do it or perhaps if you have time and interest we are more than happy to accept contributions to code base.
Matti / Testability Driver / Cutedriver and also autopilot-qt is using the same -testability flag to start the related processes.
Cutedriver related: https://github.com/nomovok-opensource/cutedriver-agent_qt/blob/master/tascore/corelib/testabilityservice.cpp#L59
And the related project file which creates the qttestability.dll file: https://github.com/nomovok-opensource/cutedriver-agent_qt/blob/master/tascore/tascore.pro
Please check that you are using the right dll file and that it is in the right path where it is looked from. For example in OS X the file needs to be inside the frameworks (if I remember correctly).
FYI: There is another dll file which is created in here: https://github.com/nomovok-opensource/cutedriver-agent_qt/blob/master/loaders/testability/testability.pro which has similar name but which is for a totally different purpose.
JP, the thing is current code in the qtbase tries to load qttestability.dll which is not the filename agentqt project generates - atleast not in windows.
There was also some errors/warnings while reading plugin metadata if I just renamed testability.dll but I did not have time to debug those.
I'll go though this a bit more later today but it seems that only thing that seems to be off at the moment is the binary name of dll which is easy to fix.
C:\src\work>c:\demo\preview -testability 2>&1|grep qttestability loaded library "qttestability" Library qttestability load failed: "Cannot load library qttestability: The specified module could not be found." loaded library "qttestability" Library qttestability load failed: "Cannot load library qttestability: The specified module could not be found." C:\src\work>
This is right after clean install of agent-qt and running a debug build of the my sut app .. so lets just leave it to that ..
Current documentation points out that adding "-testability" switch should load cutedriver's testability plugin and register itself into qttasserver.
However, it seems that this is not the case (atleast in windows) and there's also some sort of conflict with the flag -testability. Core qt source has handler for this flag that tries to load "qttestability.dll" which seems to be from canonical's autopilot-qt.
So, all in all, how the registration and plugin loading should happen is a bit of mystery.. Any possibility for clarifications into the documentation or are these conflicts a some sort of a bug ?