AWS Device Farm is an AWS service for automated testing of native (Android and iOS) and Web applications and for interactive testing of apps by remote access to mobile devices chosen from a farm of real devices hosted on the AWS Cloud. In an earlier article, "Using the Amazon AWS Device Farm to Test Android Apps," we discussed the automated testing of Android apps on the AWS Device Farm.
For user interaction on a device, the Remote Access features is provided. The Remote Access lets a user select a single remote device per remote test session from a device farm listing by make, model, and OS. AWS Device Farm displays the selected device's screen to the user in a Web browser. A user may interact with the device to upload and test an app, which could be the app previously tested on the Automated Testing platform, or a new app. By combining the Automated Testing platform and the Remote Access to a real device, an app developer is able to both test an app and also interact with the app on a real device.
In this article, we shall use the same Android Hello World app we used for automated testing to interact with the app on a real device on the AWS Device Farm. This article has the following sections:
- Testing an Android Application with Remote Access on Device/s
- Starting a New Session
- Uploading an Android Application to the Remote Device
- Testing the Uploaded Application on the Remote Device
- Running Multiple Sessions
- Stopping a Session
- Deleting a Project
- Fixing Some Common Issues
As of yet, we have only tested and verified the HelloWorld app APK. Next, we shall run the app on a real device from the device farm and interact with the device with remote access. Select the Remote Access tab in the Project settings page.
Each remote access to a single device from the AWS Device Farm requires a separate session. Click Start a new session to start a new session for a remote access device, as shown in Figure 1.
Figure 1: Starting a new Remote Access Session to a device on the AWS Device Farm
Next, select a device for an interactive session. Select LG Optimus L70, for example, as shown in Figure 2. Only a single device can be selected in a single session.
Figure 2: Selecting a device from the AWS Device Farm
Click Confirm and start session, as shown in Figure 3.
Figure 3: Confirming and starting a Remote Access Session
A Device requested dialog gets displayed, as shown in Figure 4. Initially, while an available device is being found, the message is "Waiting for LG Optimus L70."
Figure 4: Device requested
When a device gets found, the message becomes "Setting up LG Optimus L70," as shown in Figure 5.
Figure 5: Setting up a device
The LG Optimus L70 device screen also starts to get connected to, as shown in Figure 6.
Figure 6: Remote device getting initialized
The device screen gets displayed, as shown in Figure 7. The device being displayed is an actual device from the AWS Device farm, and not an emulator.
Figure 7: Remote device displaying ready for user access from local Web browser
Next, we shall upload an Android app or use an already uploaded app. Because we already tested the HelloWorld app, the app is already uploaded. Click Select a recent upload and select the HelloWorld APK, as shown in Figure 8.
Figure 8: Uploading the HelloWorld app APK
The HelloWorld app gets uploaded to the remote device.
Next, search for the uploaded app on the device itself. Click the Search icon on the device, as shown in Figure 9.
Figure 9: Selecting the Search feature
A Search field gets displayed. Search for "HelloWorld," and the app uploaded gets displayed, as shown in Figure 10. Double-click the app.
Figure 10: Searching for the HelloWorld app
The HelloWorld app starts running on the remote device, as shown in Figure 11.
Figure 11: HelloWorld app running on the remote device
The runs and sessions created may be accessed from the dashboard drop-down list, as shown in Figure 12.
Figure 12: Accessing runs and sessions
Multiple remote access sessions may be started simultaneously. With one session already running, click Start a new session to start another session. On the Choose a device page, the Name filter may be used to select a device. As an example, search for "LG" and the LG devices get listed. Select the LG G Flex (AT&T) device, as shown in Figure 13.
Figure 13: Selecting a remote device for a 2nd session
As before, click Confirm and start session, as shown in Figure 14.
Figure 14: Confirming and starting a remote session
Multiple remote access sessions get started, as shown in Figure 15.
Figure 15: Multiple remote access sessions simultaneously
The status of a remote device may be found from the session listing. The LG Optimus L70 device session is listed as "Preparing device," which implies the device is not ready to be accessed yet, as shown in Figure 16.
Figure 16: Preparing device
When the LG G Flex remote device status becomes "Running," as shown in Figure 17, click the session.
Figure 17: Device running
The remote device gets displayed ready for user interaction. Upload an Android app to the remote device from Select a recent upload or with Upload, as shown in Figure 18.
Figure 18: Uploading an Android app
Search for the HelloWorld app uploaded. Double-click the app to run the app on the remote device, as shown in Figure 19.
Figure 19: Searching for and running the HelloWorld app
The app starts running on the remote device, as shown in Figure 20.
Figure 20: Running the HelloWorld app
When an app has been tested, the session may be stopped with the Stop session button, as shown in Figure 21.
Figure 21: Stopping a remote access session
A message should get displayed indicating that the session is ending, as shown in Figure 22.
Figure 22: Remote access session ending
The icon for the session being stopped changes to indicate that it is being stopped, as shown in Figure 23.
Figure 23: Icon for a session that is stopping
When the session gets stopped, the icon changes to a green circle with a check mark, as shown in Figure 24.
Figure 24: Icon for a session that has stopped
A Device Farm project may be deleted after completing the test run/s and device session/s. Select the HelloAndroid project from the dashboard, as shown in Figure 25.
Figure 25: Navigating to a project in the dashboard
Click the HelloAndroid project in the projects listed, as shown in Figure 26.
Figure 26: Selecting the project to delete
Click the Project settings link, as shown in Figure 27.
Figure 27: Selecting Project settings
Click Delete this project, as shown in Figure 28.
Figure 28: Delete this project
In the Confirmation dialog, select the checkbox and click Delete project, as shown in Figure 29.
Figure 29: Delete project confirmation dialog
The project gets deleted.
Next, we shall discuss a common issue that a user may come across while connecting to a device on the Device Farm. While a remote device is still preparing, the initial connection could generate a network error, such as the one displayed on the device, "Network error. Check your network connections and try again.", as shown in Figure 30. Such as issue is usually temporary and a connection should get established after a while (within a few seconds).
Figure 30: Network error
In an earlier article, we introduced the AWS Device Farm for automated testing. In this article, we discussed remote access to a device on the AWS Cloud for on-device testing of an Android application. The AWS Device Farm provides several device types: not only Android apps, but also iOS apps and Web apps may be tested on the AWS Device Farm.