Run Your Test on Any Android Device
We will show you how easy it is to run your Android test on any device. Therefore add another device and instrument and deploy the application under test, as described earlier in this chapter.
Note Make sure to add a 'Close Application' action, when running your test on different devices, because if the app will not be closed on the devices, the app on the first identified device will be automated.
Add a 'Close Application' action to ensure that the recording will be executed on the right device
Make the Device, the test will be executed, variable
Open data source dialog...
Add a simple data table...
And add the device names to the simple data table
After doing so, switch to the 'Data Binding' tab and bind the data source to the variable in your recording.
Bind the data source to the variable
Have a look at Lesson 3: Data-Driven Testing if you want to learn more about the data-driven approach of testing.
Now, the test suite is prepared for running the recording on different devices. After successfully running the test, the test report should look something like the following.
Successfully executed test on two devices
Run Tests in parallel
It's also possible to run one test on multiple devices at the same time.
As there is no need to have a data source, disable the previously created data source in the test case properties.
Disable data source
Add global parameter
Bind variable to global parameter
Have a look at "Lesson 3: Data-Driven Testing" for further details about global parameters and data binding.
In the repository open the RanoreXPath of the mobile app folder using the path editor in Ranorex Spy.
Open advanced RanoreXPath editor
Add variable device name to RanoreXPath
After performing these steps you can build your test suite and execute the test case from command line using the command line arguments to set the mobile device name as described in section "Lesson 4: Ranorex Test Suite - Running Tests without Ranorex Studio":
start MobileTest.exe /pa:globalMobileDevice="Galaxy Nexus"
start MobileTest.exe /pa:globalMobileDevice="GT-P7500"