Cross-device mobile tests | Ranorex
Help CenterUser GuideWeb and mobile testing

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.

Note icon

Note

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.

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 will now be iterated for each device in your data source. This will also be reflected in your report.

Configure a parallel cross-device test

It’s also possible to run one test on multiple devices at the same time.

First:

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, i.e. 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"

Reference

Running tests from the command line is explained in:

Ranorex Studio fundamentals > Ranorex Studio Overview > ⇢ Run tests without Ranorex Studio