Creating tests for projects which are targeting several different platforms at once can get quite challenging. Even if the different versions of tested software and devices are designed quite similarly regarding their usage.

I will describe an approach to conveniently tackle such scenarios. are automatically broadcasted to each . Results from each involved platform are grouped together. This is an alternative to driving the 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. A possible use case would be tests on cloud systems where several different servers and clients may run on 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 which Hybrid-Tests can import:

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

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 same actions several times, once per platform (if an array of platforms is passed)

I will show up 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 one can verify if some folder may exist within these tree views which our AUTs showing up 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!")   

So now we can implement hybrid tests which do calls to these functions…

Implementing Hybrid-Tests using the import script:

Our functions can be called either being performed on a single platform, or even as multi-platform call, which will perform 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:


Using it in BDD styled Hybrid-Tests also is 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 would look like following then:

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


Source link


Please enter your comment!
Please enter your name here