The Squish for Qt for iOS testing package is suitable for building the iOS application for testing. You still need a Squish package for actually recording, managing and running the tests. Please see Installing from Binary Packages (Section 3.1.1) for details on installing such a package.
In order to build your application instrumented for using with Squish on
iOS, you have to unpack the package and do a build of your application with
Squish's wrapper included in the build. To include it, modify your
applications main.cpp
and .pro
as
follows:
Add
#ifdef HAVE_SQUISH # include <qtbuiltinhook.h> #endif
to your includes in the file with your main function (typically
main.cpp
).
In the same file add
#ifdef HAVE_SQUISH Squish::allowAttaching(11233); #endif
after the QApplication constructor but before you enter the event loop.
So a typical main()
function might look like:
#include "mainwindow.h" #include <QApplication> #ifdef HAVE_SQUISH # include <qtbuiltinhook.h> #endif int main(int argc, char *argv[]) { QApplication a(argc, argv); #ifdef HAVE_SQUISH Squish::allowAttaching(11233); #endif MainWindow w; w.show(); return a.exec(); }
Add
include(<path-to-squish>/qtbuiltinhook.pri)
to your .pro file (replace <path-to-squish>
with the
full path to the location where you unpacked Squish for Qt on iOS).
Now you can register an attachable application in Squish (with the IP
address of the device and the port number 11233) and attach to it from a
Squish running on the desktop. If you use a different port number in the
Squish::allowAttaching()
call, you need to register the app
with a different port number. See also Attaching to a Running Application with the Built-in Hook (Section 7.13.2.3)
for more details on attachable applications.
If you want to use Squish's Qt wrapper extensions, you have to set the
SQUISH_WRAPPER_EXTENSIONS
variable before you include the
qtbuiltinhook.pri
in your .pro
file.
Examples:
If your application uses Qt Quick 1, you should add Squish's declarative extension like:
SQUISH_WRAPPER_EXTENSIONS = squishdeclarative include(<path-to-squish>/qtbuiltinhook.pri)
If your application uses Qt Quick 2, you should add Squish's Qt Quick extension like:
SQUISH_WRAPPER_EXTENSIONS = squishqtquick squishqtquicktypes include(<path-to-squish>/qtbuiltinhook.pri)