Skip to content

Approach to Use Same Scripts for iOS & Android Devices

Worksoft SaaS provides reusability for almost all test entities that can be reused across multiple test cases. In the case of mobile app automation, where there are different locators altogether due to differences in platforms, by providing these very different locators in the same script, you negate the need to design multiple test scripts for different platforms.

To understand this better let us take two different platforms for HICC mobile application. Since the platforms are different, the locators are also completely different for the same app. One solution is to make different scripts, each one dedicated to a single platform. 

In “HICC Prod Android” and “HICC Prod iOS” platform if you take age input field as an example, the former will have locators for only Android and the latter will have locators only for iOS. Creating different scripts for each platform of the same app will defeat the concept of reusability and also double the amount of test scripts (and other related entities) in Worksoft SaaS .



(Different locators in Android and iOS)

A better solution is to add the locators of both platforms in the same test script. Worksoft SaaS tests can iterate through multiple locators/xpaths in the same instruction.


As you can see in the above screenshot, for one script Enter Details & Submit, there are two locators added for the same instruction, the first one being for Android and second for iOS. 

How does Worksoft SaaS know which one is supposed to be used? Worksoft SaaS does not use specific locators until the scripts are built with conditionals. During the test run, all provided locators will be iterated through and when one is found, the specified action will execute. 

For example, the first locator //XCUIElementTypeTextField will not be found for any Android devices, so that only leaves the second locator, and vice-versa for iOS devices.

Feedback and Knowledge Base