Creating tests for projects which target several different platforms at once can be quite challenging, even if the different versions of tested software and devices have the “same” GUI.

I will describe an approach to conveniently tackle such scenarios. Using this approach, test steps are automatically broadcast to each target system, and results from each involved target platform are grouped together. This is an alternative to driving the test and verifications separately for each target platform.

I will give a short example on how test scripts can be developed for performing on several platforms within single test steps. One possible use case could be when testing web-based applications where several different browsers can be used from different platforms.

The example I’ll give, assumes that all involved AUTs (Applications Under Test) have been started up already, have been registered as ‘Attachable AUTs’ with running squishservers, and are now waiting for the test to start. (see: squish documentation)

A helper script for managing multiple targets

Let’s begin creating a Python class which can store each application’s ‘name’ and ‘applicationContext’ properties. In addition it holds platform-dependent functions and platform-dependent ‘Name Objects’ that may be needed from the tests:

class ApplicationPlatform:
    nam = ""
    ctx = None
    obj = []
    fnc = []
    def __init__(self,appNam,host="localhost",port=4322):      
        self.ctx = attachToApplication(appNam,host,port)
        self.nam = appNam

Also let us define a function which attaches to all tested applications and devices by returning an array of such ‘ApplicationPlatform’ objects, as well as global variables for indexing these:

def attachToAllApps():
    return [ ApplicationPlatform("DesktopApp"),
             ApplicationPlatform("AndroidDevice") ]



Implementing Multi-Platform callable functions:

Now we can implement verification functions which take ApplicationPlatform objects as parameter, which are able to perform either:

  • On just one distinct platform alone (if just one platform object passed)
  • Or by doing the same actions several times, once per platform (if an array of platforms is passed)

Here are two example functions, the first one automates AUTs to create new folders in the cloud’s file system structure:

def createNewFolder(app,fldNam,i=0):
    if typeName(app) == "list":
        if i<apps.__len__():

The second example can verify if some folder may exist within these tree views which our AUTs display for accessing files within the cloud:

def verifyFolderExists(app,fldNam,i=0):
    if typeName(app) == "list": 
        if i<apps.__len__():
        fldObj = names.treeView_folder
        if object.exist(fldObj['name']):
            test.passes(app.nam + ": '"+fldNam+"' exists!")
   + ": '"+fldNam+"' doesn't exist!")   

Now we can implement multiple-platform tests which make use of these functions.

Implementing Multiple-Platform Tests using the import script:

Our functions can be called from a single-platform tests, or from a multiple-platform test, which will run on all of our platforms at once:


def main(): 
    platforms = attachToAllApps()

    # 1 add a new folder on just the 'Desktop' application:

    # 2 verify if new folder "FolderXY" exists on all devices connected to the cloud:


BDD-styled multiple-platform tests are also possible:

Assume following scenario:

Feature: Syncing Documents in a Cloud

Scenario: Synchronize file system between devices

When I create a folder “FolderXY” in the Desktop application.
Then I expect new folder “FolderXY” appears on all devices connected to the cloud.


Our step implementations might look like this:

@When("I create a folder “FolderXY” in the Desktop application")
def step(context):
    # lets assign our platform array to the BDD context's userData
    # variable, so it also can be used by other steps which follow:
    context.userData = attachToAllApps()

    # we can call our functions to be performed on just one platform:
@Then("I expect new folder “FolderXY” appears on all devices connected to the cloud.")
def step(context):
    # and we can call being performed on all of the platforms at once 

Related links:


Attaching to running applications:


Leave a Reply

Your email address will not be published. Required fields are marked *

Copy link
Powered by Social Snap