Configure one mobile test to run on multiple devices of the same mobile OS (Android or iOS)—either consecutively (one after another) or in parallel (at the same time).
This setup is based on data-driven testing and works the same way for Android and iOS. For simplicity, screenshots in this article may show Android only. The workflow is identical on iOS.
Configure a consecutive cross-device test
- Open the first recording module in your test. It should contain the Run mobile app action.
- Click the Endpoint property and click As new variable…
- Name the variable varMobileDevice. This variable will control which device the test app will be started on, and therefore, where the test will be run.
- Switch to the test suite view.
- Right-click the test suite that contains the recording with the Run mobile app action and click Data source…
- In the dialog that opens, click New > Simple data table.
- Fill the data table with the names of the desired devices as they appear in the endpoints pad.
- Click Data binding and under Module variable, bind the data column with the device names to the device variable varMobileDevice.
- The test is now iterated for each device in your data source. This will also be reflected in your report.
Configure a parallel cross-device test
Use this option when you want to run the same test at the same time on multiple devices
1. Configure a variable as in steps 1-3 in the instructions for a consecutive cross-device test above.
Or simply disable the existing data source if you’re working with the test from the instructions for a consecutive cross-device test above.
- In the test suite view, right-click the test suite node and click Global parameters…
-
Add a global parameter called globalMobileDevice.
- Right-click the test case that contains the recording where you specified the variable and click Data binding…
- Under Parameters > Module variable, bind the variable to the global parameter.
- In the repository, find the app folder for your mobile app and click EDIT IN SPY.
- Modify the path as in the screenshot below and ensure the attribute devicename has the value $varMobileDevice, for example, the device variable specified earlier.
- To run your test in parallel, start it from a command line environment with the following arguments:
start MobileTest.exe /pa:globalMobileDevice="Galaxy Nexus"start MobileTest.exe /pa:globalMobileDevice="GT-P7500"