For a user who is evaluating new software, the installation process is usually the first interaction he’ll make with that product.
During this process, any error or misbehavior which makes the installation of the software difficult could lead the user to switch to a competitor’s product.
So, to minimize the chances of losing a potential customer, it is important to develop and run additional tests (besides the regular unit and GUI tests) against the software’s installer packages.
A setup program in most cases is a compressed data package, consisting of just the software’s binary files (plus some additional installation information
about where and how these have to be installed and registered) and often there is no executable program code contained within. So this can’t be hooked and automated the usual way like other programs.
But in most cases, testing should be possible anyway.
I will give two short examples showing how ‚Squish for Windows‚ can be used for automating such ‚.msi‘ based software installers.
Lets say we want to test a setup-package ‚
Installer.msi‚. This can be done in one of the following ways:
1) By creating a batch script:
For running such a test, Squish needs to first hook into that process which is performing the package’s installation flow. For ‘.msi’ packages, on windows, this is done by the system’s package installer program ‘msiexec.exe’.
At first, the windows installer executable msiexec.exe needs to be registered at the squishserver, which can be easily done by the squishrunner command:
squishrunner --config addAUT msiexec "C:\Windows\System32"
Now create a batch file just beside ‚
Installer.msi‚ which should be tested. Open it in a text editor and add a command line that will execute installation of the package:
C:\Windows\System32\msiexec.exe /package Installer.msi
Store it by filename ‚
Installer.bat‚ and then register file as well by squishrunner command at the squishserver:
squishrunner --config addAUT Installer.bat "C:\path\to\Your\AUTs".
This new created batch file Installer.bat now can be selected to be the AUT within test suites the usual way now.
2) Another, more advanced approach would be by registering ‚msiexec.exe‘ directly as the AUT:
Register ‚C:\Windows\System32\msiexec.exe‘ with the squishserver (by either command line or by Squish IDE) as ‚Managed AUT‘ and create a new test suite and set this as the AUT. The path to our .msi installer package then needs to be passed as “/package” start parameter to it.
This can be done either by:
using ‚Test Suite Settings‘ within the Squish IDE – so the package start parameter will be given automatically each time a test case is started.
setting paths to different .msi packages manually – to each test case’s ‘startApplication()’ calls, so testing several setup packages, each per single test case is possible then.
startApplication("msiexec /package C:\\path\\to\\Installer.msi")
Wikipedia article about the software component ‚Windows Installer‘:
froglogic knowledge base article which describes msi installer automation by Python script: