Automating more than one application in a single test case is doable but what if the UI technology differs? We would like to show you how to handle two applications in a single test case, using two different Squish packages and squishservers as well as advantages and disadvantages of this setup. Let’s get started.
We’ll use a Windows application and a website in this example since this is a common setup. The Windows example application is the addressbook example that is shipped with every Squish for Windows package. Having Squish for Windows and Squish for Web (+ browser extension) on the machine is set as a precondition.
Since we need a squishserver for each of the packages, we start them via the command line:
C:\Users\franke\squish\squish-6.4.1-windows\bin>squishserver --port=4444 C:\Users\franke\squish\squish-6.4.1-web-windows\bin>squishserver --port=5555
The squishserver handles the communication with the Application Under Test. In this case, this is with the web browser (website) and with the addressbook application.
Now we can begin to develop our test.
Information that is important for external squishservers as well as the Windows and web support need to be stored in variables.
winAutName = "Addressbook" squishPackageWindows = "C:\\Users\\franke\\squish\\squish-6.4.1-windows" squishPackageWeb = "C:\\Users\\franke\\squish\\squish-6.4.1-web-windows" website = "https://www.froglogic.com" squishServerWeb = 5555 squishserverWin = 4444 host = "localhost"
To be able to use the toolkit support of a different Squish package we need to change the environment variable SQUISH_PREFIX. That way, we can execute the test case from any package without a problem.
Setting the correct wrapper and starting the __squish__webhook as the AUT is needed to start a browser and inject our hook mechanism.
os.environ["SQUISH_PREFIX"] = squishPackageWeb testSettings.setWrappersForApplication("__squish__webhook", ["Web"]) ctx_web = startApplication("__squish__webhook","localhost", squishServerWeb) startBrowser(website)
For switching between the Windows-based application and the browser, two things are needed:
- Application Context, to send any kind of commands (e.g. button press, typing, etc.) to the right application
- Toplevel API, to bring the application into the foreground and set the input focus
setApplicationContext(ctx_win); winToplevel = ToplevelWindow.byObject(waitForObject(names.address_Book_Unnamed_Window)) winToplevel.minimize()
Sending commands to an application which doesn’t have the input focus could cause some problems. Therefore Squish provides a so called „Toplevel API“ which helps to bring an application into the foreground, set the focus or minimize it. This does not work for web browsers. The workaround is to minimize the Windows application, and leave the web browser as is.
- Because we use two squishservers to launch each Squish edition, and a third to launch the IDE, we cannot record properly on both applications from the squishserver that is launched by the IDE. For example, if you include a breakpoint in your script, upon playback within the IDE, you will be unable to record from that instance.
- Since multiple Squish installations are present, these need more storage capacity than a single package would need.
- You can create a working setup easily on your own.
- Upgrading/exchanging one of the used packages can be done without much effort.
Using separate Squish packages has it’s advantages and disadvantages but you have to decide on your own which way you want to go.
Instead of separate packages you can reach us to get a combination package. That way, you only have one Squish installation as well as a single squishserver which can handle the different toolkits.