AWS Device Farm: What Is It?
AWS Device Farm is an app testing service that you can use to test and interact with Android, iOS, and web apps .
In this blog post, we will discuss the capabilities, benefits, and best practices of AWS Device Farm, showcasing how it may transform your app testing strategy.
There are two ways to use Device Farm:
Remote access of devices onto which you can load, run, and interact with apps in real time.
Automated testing of apps using a variety of testing frameworks.
1. Remote Access Interaction
Remote access allows you to swipe, gesture, and interact with a device through your web browser in real-time. There are several situations where real-time interaction with a device is useful. For example, customer service representatives can guide customers through the use or setup of their devices. They can also walk customers through the use of apps running on a specific device.
You can install apps on a device running in a remote access session and then reproduce customer problems or reported bugs. During a remote access session, Device Farm collects details about actions that take place as you interact with the device. Logs with these details and video capture of the session are produced at the end of the session.
Here’s a step-by-step example of using AWS Device Farm for remote access:
Step 1: Create an AWS Account
If you don’t already have an AWS account, create one at aws.amazon.com.
Step 2: Navigate to AWS Device Farm
Once logged into your AWS account, navigate to the AWS Management Console and enter "Device Farm" in the services search field. To open the Device Farm console, click "AWS Device Farm".
Step 3: Create a Project
Under Mobile Device Testing click on Projects.
Then click new project and add a name for your project. A project helps you organize your test runs and test artifacts.
Step 4: Choose Devices
AWS Device Farm offers a wide range of device emulators for testing. Select the devices you want to use for your test runs. You can choose specific devices and device pools, or even create your custom device pools.
Here I choose Samsung Galaxy S23 Ultra device.
Step 5: Upload Your Application
Prepare your mobile or web application package for testing. For mobile apps, you can upload the APK or IPA file.
Step 6: During the remote access session, you can interact with the device, install additional apps, capture screenshots, collect logs, and perform manual testing or debugging.
2. Desktop Browser Automation Testing with Selenium Java
When it comes to automation testing frameworks, there are various options available for use with AWS Device Farm. One popular framework worth exploring is Selenium with Java, which allows for efficient desktop browser testing. In this blog, we will take a closer look at how Selenium Java can be used in AWS Device Farm for desktop browser testing.
Step 1: Create a Project
In the Device Farm console, under Desktop browser testing, click “New project.”
Step 2: Give a project name and description (optional) and click on the Create button.
Note: If you are running your script locally, you don’t need to add any VPC details.
Step 3: Now create a Maven project in your local system with your preferred IDE and add the following dependencies for the AWS SDK in the POM.XML file:
Step 4: Create one class and add the Selenium test script as mentioned in the screenshot:
Here I am creating a request for Remote WebDriver and desired capabilities then my test script.
For example I want to open https://google.com in Firefox browser.
Step 5: Replace projectARN with your project ARN as shown below in the screenshot:
Step 6: Go to https://us-east1.console.aws.amazon.com/iamv2/home#/security_credentials and create a user.
Step 7: Select the user, go to the security credential tab, and generate the access and secret key for that user.
Step 8: Set the Access key and secret key as environment variables in your system to enable AWS Device Farm access.
Step 9: Then run the script locally.
Step 10: Go to the Project section under the session to access a list of test runs.
Step 11: Under session id, you will get the session videos, actions, and file details.
The Best Ways to Use Amazon Device Farm:
To reach most of your target audience, choose a variety of devices and make sure you've thoroughly tested them.
Utilize the automation frameworks that AWS Device Farm supports to effectively run tests on a variety of devices.
To maximize test coverage and minimize execution time, concentrate on high-value test cases.
Use performance testing capabilities to identify and resolve performance bottlenecks proactively.
To speed up issue resolution, send engineers thorough test reports and keep lines of communication open.
In summary
AWS Device Farm offers a scalable, effective, and affordable solution that transforms the testing of mobile apps. Software testers are empowered to guarantee app compatibility, performance, and quality across a wide range of devices and operating systems by its vast device fleet, automation capabilities, remote access, and performance testing features. You may create user-impressive mobile applications, expedite bug discovery and resolution, and simplify your testing procedures by utilizing AWS Device Farm.