Using Squish to automate Qt Installer Framework UI Tests

Introduction

Installers built with the Qt Installer Framework link with Qt libraries in a static way. This means that for Squish to hook into one, it needs to attach to an already running AUT and the AUT must have a built-in hook. The steps for adding this hook to an installer are greatly simplified now that Squish support is included in the Qt Installer Framework (the commit c0b2007d). This article will give you step-by-step instructions on how to make your installer accessible from Squish.

To take advantage of this support while building your installer, specify a path to a Squish build as a command line argument to qmake when compiling the Qt Installer Framework:

<path_to_qt>\bin\qmake -r SQUISH_PATH=<path_to_squish>

Practically, what this does is add the Squish built-in hook for Qt into the installer program which is generated by the framework.

Building Squish

Before building your installer, you first need a Squish build for your target version of Qt. You can make one by following the instructions from Installing Squish for Qt from Desktop Source Packages. That is, in an empty folder, from the command line environment of your compiler (Visual Studio 2017 in this case), type:

<path_to_squish_sources>\configure --with-qmake=<path_to_qt>\qmake --enable-qmake-config --disable-all --enable-idl --enable-qt

This <path_to_qt> is the path to the same Qt which is used for building the Qt Installer Framework. If you don't have this, you can also make one by following the instructions from the Getting Started page in the Qt Installer Framework documentation. Just be aware that the newer Qt versions might need slightly different configuration switches than what are used in this article. In Qt 5.9.6 for example, you won't be using the switch -target xp because there's no such switch anymore.

Anyway, let's get back to Squish. Once the Squish build is configured, you just have to type:

build
build install DESTDIR=<path_to_squish>

This will build Squish and install it in the folder <path_to_squish>. This folder (i.e path to it) will be used when building the Qt Installer Framework.

Building Qt Installer Framework

It's usually good to build a project in an empty folder rather than in the folder with sources, so let's do that here. In an empty folder, from the command line prompt of your compiler, type:

<path_to_qt>\bin\qmake <path_to_qt_installer_sources>\installerfw.pro -r SQUISH_PATH=<path_to_squish>

If everything is okay, you should see in the command line prompt the message:

Project MESSAGE: Squish: including builtin-hook in installerbase build/deployment

After this, you can start building the project by typing:

nmake

or just make in case you are using GCC or similar compilers.

Each installer program which is built with this framework will by default start listening on the port 11233 for incoming Squish connections after it's started. If you you would like to use a different port, then you can start your installer with the switch --squish-port <number>.

So for example, if you build a Qt Installer Framework Example, such as the Dynamic Page Installer, it will start listening for Squish connections at the port 11233.

Using Squish

To use Squish with such installers, you must first register an attachable AUT with the Squish server. In the Squish IDE, go to menu Edit > Server Settings > Manage AUTs... and then under the Manage AUTs setting, select Attachable AUTs and click the button Add ... . In the little dialog which pops up specify: Name, Host and Port number for the new attachable application:


After this, create a new Squish test suite for Qt applications and don't specify the AUT in the test suite wizard. Once when you complete this step, click on the toolbar button Launch AUT or alternatively, in the menu Run click the item Launch AUT and chose the attachable application to which you want to connect (in the screenshot above that would be installer) .

When the connection to the running installer application is established, you will be able to pick and inspect its GUI components:

Comments

    The Qt Company acquired froglogic GmbH in order to bring the functionality of their market-leading automated testing suite of tools to our comprehensive quality assurance offering.