Cross-device mobile tests
In this chapter, we’ll show you how you can configure one test to run on several different devices of the same mobile OS (Android OR iOS) consecutively and even in parallel.
The configuration is based on data-driven testing and is the same for both Android and iOS. For the sake of simplicity, the screenshots refer to Android only.
Make sure to add a Close application action when running your test on different devices. Otherwise, the tests may run in a different order or be skipped for some devices.
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.
Right-click the test suite that contains the recording with the Run mobile app action and click Data source…
Fill the data table with the names of the desired devices as they appear in the endpoints pad.
Configure a parallel cross-device test
It’s also possible to run one test on multiple devices at the same time.
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.
Under Parameters > Module variable, bind the variable to the global parameter.
start MobileTest.exe /pa:globalMobileDevice="Galaxy Nexus"
start MobileTest.exe /pa:globalMobileDevice="GT-P7500"