Selecting target Android devices during execution
From within your action lines, you can control which Android device(s) your test is to execute on.The built-in use device action is used to specify a target device upon which the subsequent action lines are to be run.
An example to indicate which Android device to run automated tests on during runtime might look something like this:
The assign device action (line 42) assigns a logical or friendly name to a connected Android device. The unique id argument represents an unique device identifier. To obtain the device identifier of an Android device, refer to assign device.
The use device action (line 45) uses the logical name established in assign device to inform TestArchitect that the subsequent action lines are to be run on that device.
Finally, when testing on the new target device completes, it can be logically disconnected from the test host machine with disconnect device (line 50). The subsequent action lines, if any, are run on the host machine.
The use device action allows automated tests to be run on different mobile devices. The devices must all be connected to the host controller on which the test is running, and execution across devices takes place in serial fashion. (This is essentially the equivalent of serial synchronous remote execution for desktop application testing.)
The above procedure begins with unique identifiers for two devices being assigned to friendly names. The use device action (line 47) commands a chunk of action lines to be executed on device 1. The second use device line (line 52) switches the current connection from device 1 to device 2, which also switches the execution domain, so that the subsequent chunk of action lines is run on device 2.
When test execution on all mobile devices is complete – or it is simply necessary to switch execution to the host controller for an interim task – a disconnect device is issued, which logically disconnects device 2 and allows for subsequent action lines to run on the host.
Because each device has a unique ID, and those IDs are used to create the logical names (via the assign device action), if you want to execute a multiple device test on multiple controller/device clusters, your assign device actions must vary by cluster.
The following action lines can be employed for running a single test on multiple clusters. The test begins by querying the host machine to determine which controller the test is currently running on. By knowing the controller, it knows which devices are connected to it, and can assign those device IDs to logical names accordingly.