Running Appium on AWS Device Farm - Bug Reaper

                  Bug Reaper

Lean about Automation Testing,Selenium WebDriver,RestAssured,Appium,Jenkins,JAVA,API Automation,TestNG,Maven, Rest API, SOAP API,Linux,Maven,Security Testing,Interview Questions

Sunday, 16 June 2019

Running Appium on AWS Device Farm





For Setting up The Appium Script on AWS device Farm we need lot of Plugins to Setup on Pom.xml


Example below Plugins are required


We need to convert into jar

 in order to do this maven JAR plugin to pack all the tests into a single JAR file.

Next you need to build all dependencies(i.e Packing Dependencies ) into a single jar file with maven dependency plugin


<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.2</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/dependency-jars/</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>zip-with-dependencies</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assembly/zip.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>



So now you will have two JARs files in your target folder. One containing your tests files and the other containing dependencies.

As you can see in Above Pom.xml

We have mentioned one file under path src/main/assembly/zip.xml

So we will create one zip.xml file to 
Zip Everything!


Zip.xml


<assembly
        xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
    <id>zip</id>
    <formats>
        <format>zip</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <fileSets>
        <fileSet>
            <directory>${project.build.directory}</directory>
            <outputDirectory>./</outputDirectory>
            <includes>
                <include>*.jar</include>
            </includes>
        </fileSet>
        <fileSet>
            <directory>${project.build.directory}</directory>
            <outputDirectory>./</outputDirectory>
            <includes>
                <include>/dependency-jars/</include>
            </includes>
        </fileSet>
    </fileSets>
</assembly>



Now Lets Package Everything

Go to CMD Project Location and type


mvn clean package -DskipTests=true

After the Build is success you will see a zip file with name "zip-with-dependencies.zip"




Now we need to upload this zip file in AWS



Go To AWS Device Farm and follow below Screenshots

1.) Create New Project



















2.) Create New Test Run



3.) Choose Application i.e. apk file in case of Android





4.) Configure your test i.e. Select Appium with TestNG









 5.) Select Devices


6.) Start and Click on Run


7.) Execution Results will be shown with logs, Screenshots,Video Recordings


No comments:

Post a Comment