Test Amazon Shopping App with Aws DeviceFarm and Appium
Introduction to AWS Device Farm
AWS Device Farm is App Service Testing hosted by Amazon. This provides platform to test and interact with iOS, Android and web applications on real mobile devices and tablets. AWS Device farm can be used for :
1. Automated testing of apps and
2. Remote access of devices for real time interaction.
Why Appium with AWS Device Farm?
There are many reasons for this, like support for parallel execution. Availability of multiple mobile and tablet devices and also it helps us to identify
Here is the list of pre- requisite:
1. Appium (Prefer using latest stable version)
2. Java IDE- I will be using Eclipse
3. Appium script written in Java, TestNG, Maven
4. AWS Account with IAM user permissions
Here is the list of supported methods to test applications on AWS Device Farm.
> Appium Java JUnit
> Appium Java TestNG
> Appium Python
> UI Automator
Here is what needs to be done to execute Appium tests on AWS Device Farm?
We have to do two things:
1. Appium Java package wrapped into .zip format for upload on AWS Device Farm
2. Package contain all of the test's dependencies.
Preparing Android Appium Java TestNG
Ensure that packaging type is Jar in POM.xml file. This jar file will be used in AWS device farm to execute our tests.
Add the below plugin in POM file, this will allow to package our test classes as a jar file using “test-jar” goal.
Add maven-dependency-plugin to build dependencies as JAR files using “copy-dependencies” goal. This takes the list of project dependencies and copies them to a specified location, stripping the version if desired.
We need to copy zip.XML assembly file from AWS to our project directory. This zip file will copy all dependencies jar directory and the jar file that contains all the test scripts. It will bundle everything and finally create a zip file. This xml file should be placed inside “src/main/assembly/zip.xml” folder.
Use maven-assembly-plugin to package tests and all dependencies into a single zip file.
Build, package and verify
mvn clean package -DskipTests=true
Upload the package on Device Farm Console.
We need to upload all the artifacts highlights from above screenshot in the AWS device farm, as Device Farm will be using them. Below are the steps for this.
Follow the steps as in above diagram, after login to AWS, create a new run, upload zip file of the application, select devices to execute tests and start run.
Once the execution is completed, you will see report, screenshots and execution video. You can also explore logs. Just to let you know AWS device farm gives initial 250 minutes of test execution fee of cost.
Hope this was useful! If you ever need my help, you can write in comments sections. Also, you can contact me through my LinkedIn Profile.