Installing Squish for Qt for iOS testing

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 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:

  1. 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();
                }
  2. 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).

  3. 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 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)

© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.