My first encounter with AWS Device Farm

By Sandhya

Device Farm is an app testing service available in the  bunch of  several AWS services. This facilitates testing Android app on real , physical phones of multiple flavors.

My maiden attempt to test a native app using AWS Device Farm is interesting and successful. I tested the app using appium frame work that supports cross-platform testing. I will share my experience with appium framework in my next posting.

Here is how AWS Device Farm is deployed to test Android native app, implementing appium automation test; my code is as below. 

Code for takescreenshot :

Next step is to upload Appium test package to AWS device farm . This package should contain all the tests and dependencies and must be in zip format.

The following instructions will guide, how to meet these requirements during the package stage of a Maven build.

1. Modify pom.xml to set packaging as a JAR file:

2. Modify pom.xml to use maven-jar-plugin to build your tests into a JAR file.
The following plugin will build your test source code (anything in the src/testdirectory) into a JAR file:

3. Modify pom.xml to use maven-dependency-plugin to build dependencies as JAR files.
The plugin below will copy your dependencies into the dependency-jarsdirectory:

The following XML is an assembly definition that, when configured, instructs Maven to build a .zip file containing everything in the root of your build output directory and the dependency-jars directory:

5. Modify pom.xml to use maven-assembly-plugin to package tests and all dependencies into a single .zip file.

The following plugin uses the preceding assembly to create a .zip file namedzip-with-dependencies in the build output directory every time mvn package is run:

6. Build, package, and verify. For example:

After you run mvn clean package -DskipTests=true, you will find file in target folder.

Now go to aws console and login .

Step 1: Go to Device Farm service and create a project.

Step 2: Under the created project, create a new run
select application type (Native app on android or ios/ web application)

Selected  native app. (prompted to select apk/ipa file to upload)


I have uploaded apk file ; It processes and details of the uploaded apk  are shown as  below.



Proceed to next step by clicking on next step.

Step 3:  Configure test > select test type : I selected Appium Java Test NG [because I implemented my tests using testNG framework] and upload the zip file which contains your test and dependencies jars.



Proceed to next step

Step 4: Select devices on which you want to test your application .



Step 5: review and start run : Here we can change the selected apk/ uploaded test package/ selected devices.


Click on start run. You will see the list of devices on which the tests are running as in the screen shot shown below.



After completion of all tests in all the devices the screen will be seen as below.



Click on screen shots tab to see screens on each selected device.



You will notice the change in the  display pattern, if any, in different devices tested.