Create a Unified mobile test case
A Unified application holds one test case that runs on both Android and iOS, instead of 2 sets of test cases covering the same scenarios. You author the steps once, on either platform, and the platform-aware engine resolves the right locator for each device at execution time.
Before you start, you need a Unified project and application, the application file, and a device available as a Test Machine. Android takes an .apk or .aab; iOS takes an .ipa or .app. A local device also needs Testsigma Terminal installed.
Create the test case
Section titled “Create the test case”-
Go to Create Tests > Test Cases.
-
Expand a folder in Test Case Explorer and click the + icon next to a subfolder.
-
Confirm the folder and subfolder, enter a name, and click Create.
The first step is created for you as Launch App.
Add the steps
Section titled “Add the steps”- Click Record on the Test Case Details page.
- In the Record test steps overlay, select a Test Lab and a Test Machine.
- Supply the application under App Source, either by pasting an external public link or by clicking Upload and browsing to the file.
- Click Record and wait for the application to load fully.
- Perform the actions you want as test steps. The recorder converts each interaction into a step.
- Click Stop, then Stop again in the Stop Recorder dialog.
An .ipa upload carries 2 options an .apk does not. Enable iOS Keychain Support clears Keychain data after each session, so credentials stored by a previous session cannot fail the next. Skip App Re-signing installs the build without re-signing it, for an app already signed under the Apple Developer Enterprise Program and for features that need the original signature, such as push notifications.
- Click Add New Step on the Test Case Details page.
- Select the NLP for the action you want, then supply its test data and elements.
- Repeat until the flow is complete.
Mobile NLPs use Tap on rather than Click on. See Create test cases for the full action list and the step types.
Elements with a locator per platform
Section titled “Elements with a locator per platform”An element in a Unified application holds locator details for Android, iOS, or both, under one name. A step referencing that element uses the Android locator on Android and the iOS locator on iOS, so one element library serves both platforms.
The same 5 locator types apply, and you can choose a different one per platform on the same element:
- Accessibility ID: the most reliable across platforms, since the value tends to stay the same on Android and iOS
- ID: the second most reliable. Every element typically has a unique one
- XPath: parses the source to locate the element by its path
- Class Name: the value of the element’s Class Name attribute
- Name: the value of the element’s Name attribute
Create an element manually
Section titled “Create an element manually”-
Go to Create Tests > Elements and click Create Element.
-
Enter a Name and a Screen Name.
-
Select the Android tab, choose an Element Type, and enter the locator in Enter Value.
-
Select the iOS tab and do the same for iOS.
-
Leave Auto heal element during execution selected to let Testsigma recover this element’s locator when it changes, or clear it to opt out.
-
Click Create element.
To change one later, hover over it on the Elements page, click the ellipsis icon ⋮, select Edit, and update the Name, Screen Name, or either platform’s type and value. Click Update.
Record an element
Section titled “Record an element”Recording captures one platform at a time, and needs the Testsigma Recorder extension installed. See Recorder extension.
-
Go to Create Tests > Elements and click Record.
-
In the Record Elements overlay, select the Test Machine for the platform you are recording, along with the Test Lab and Upload App Source.
-
Click Record and wait for the app to load fully.
-
Click the element you want to capture.
-
Confirm the Name, Screen Name, Element Type, and Value in the Create Element panel.
-
Click Create. The element saves to the elements list and appears in the Create Element panel.
-
Repeat steps 4 to 6 for every element you want from this application, then click Stop Recording. You are returned to the Elements page with everything you captured.
To add the second platform’s locator to an element you already captured, open it on the Elements page, click Edit, select the tab for the platform you have not captured, click Record, and capture it there. That adds to the existing element rather than creating a duplicate.
Run it on both platforms
Section titled “Run it on both platforms”Run the same test case on an Android device and on an iOS device from the Ad-Hoc Run panel.
Locators recorded on one platform will not always match the other. Where they do not, auto-healing corrects them at run time rather than failing the step.
An auto-healing example
Section titled “An auto-healing example”Take a login test case authored in a Unified project by recording on an iOS device:
Launch AppTap on Log InTap on Email Address or UsernameEnter brandon@bryant.com in the Email Address or Username fieldEnter the password in the Password fieldTap on Forgot PasswordEnter brandon@bryant.com in the Email Address or Username fieldTap on Reset PasswordIt runs on iOS with the recorded locators. On Android, those locators do not match the UI. With auto-healing enabled, Testsigma detects each failed locator during execution and replaces it with a new XPath, using the element context from both platforms, so the test lab finds the element and the step continues.
A summary banner at the end of the run reports how many steps were healed, and the run completes as Passed.
To see what changed, open the step in the run result. Autoheal Details shows the updated locator and Affected Test cases shows what else uses it, and you can mark whether the result was helpful. See Elements for auto-healing.
Frequently asked questions
Section titled “Frequently asked questions”Can I test both Android and iOS with a single test case?
Section titled “Can I test both Android and iOS with a single test case?”Yes. Create a Unified application and author one test case. Testsigma runs it on both platforms.
Which execution engine does Unified Mobile use?
Section titled “Which execution engine does Unified Mobile use?”The Modern engine only. It is not available on Classic.
Do I record the test case twice, once per platform?
Section titled “Do I record the test case twice, once per platform?”No. Record on one platform, and the same test case runs on both. Elements are the exception: recording an element captures one platform’s locator, and you add the second platform’s locator to the same element afterwards.
How does Testsigma handle elements that differ between Android and iOS?
Section titled “How does Testsigma handle elements that differ between Android and iOS?”Each element stores a separate Android and iOS locator, and Testsigma uses the one matching the device under test. Where a locator differs at run time, auto-healing corrects it.
What happens to a step that only applies to one platform?
Section titled “What happens to a step that only applies to one platform?”It is skipped on the other platform, and the run reports the reason.
Can I convert an existing Android or iOS application to Unified?
Section titled “Can I convert an existing Android or iOS application to Unified?”No. The application type and engine are set when you create the application and cannot be changed. Create a new Unified application instead.
Was this page helpful?
Thanks for the feedback.