Appium as Solution for Mobile Functional Testing Series 3

Configuring installed software

Java JDK

  • Go to JDK folder and copy path like
  • Set JAVA_HOME environment variable
  • Set JDK bin folder path variable (Do not delete existing path just put “;” at end and paste JDK bil folder path
  • Check java is properly installed and configured in system

Android SDK

  • Extract download ADK zip in any hard drive
  • Structure of directory after extraction
  • Open SDK Manager >> tools >> install Android API version

Click checkbox >> Install packages

 

Set ANDROID_HOME system/user variable and add path

  1. Copy SDK directory path
  2. Create system/user variable and add SDK directory path
  3. Add adb.exe file directory path in path variable
  4. Verify SDK setup

 

Create ,Configure and start Android Emulator (AVD )

  • Open SDK manager and click on tools >> Manage AVD

Note:

  • To create AVD , in SDK you should have instaelled atleast 1 API ie. API – 19
  • Appium works n API – 17 +
  • Click on New
  • Configure AVD as shown in below image and click on ok
  • Devices AVD added in list and select AVD >> click on Start >>Launch
  • AVD will launch in couple of minute and it’ll start loading Android version
  • Loding API on AVD will take around 3 to 5 min and after loading it’ll look like below image

Install Node.js

  • Click on Setup file and follow instruction

Maven configuration

  • Extract maven zip file in C: driver
  • Add MAVEN_HOME in system/user variable

 

  • Add maven >> bin directory path in system path veriable
  • Verify maven installation

GIT Installation

  • Click on Setup file and follow instruction
  • GIT directory automatically added in system path variable
  • Verify git setup


Eclipse installation

  • Extract eclipse bundle in any hard driver click on Eclipse.exe
  • Create workspace
  • Install TestNG plugin
  • Go to Help >> install new software >>enter url

http://beust.com/eclipse

 

And follow instruction

 

  • Install MAVEN plugin

Go to Help >> install new software >>enter url

http://download.eclipse.org/technology/m2e/releases

And follow instruction

  • Install ADT plugin

Go to Help >> install new software >>enter url

https://dl-ssl.google.com/android/eclipse/

And follow instruction

Create MAVEN project from command line

  • Open CMD and navigate to directory where you want to create project
  • Run command

mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

Note: Group id = package name

Artifact name: project name

  • After successfully run you will see “Build success” massge at end of CMD result
  • Now navigate in newly created project folder “cd <project name>
  • Run command mvn eclipse:eclipse
  • Open eclipse and import >> maven >>existing maven project >>project directory path
  • Open POM.xml and add following dependency and build path

 

<dependencies>

<dependency>

<groupId>junit</groupId>

<artifactId>junit</artifactId>

<version>3.8.1</version>

<scope>test</scope>

</dependency>

<dependency>

<groupId>org.seleniumhq.selenium</groupId>

<artifactId>selenium-java</artifactId>

<version>2.44.0</version>

</dependency>

<dependency>

<groupId>org.testng</groupId>

<artifactId>testng</artifactId>

<version>6.1.1</version>

<scope>test</scope>

</dependency>

<dependency>

<groupId>io.appium</groupId>

<artifactId>java-client</artifactId>

<version>2.2.0</version>

</dependency>

</dependencies>

<build>

<plugins>

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-compiler-plugin</artifactId>

<version>2.3.2</version>

<configuration>

<source>1.6</source>

<target>1.6</target>

</configuration>

</plugin>

</plugins>

</build>

 

  • Build project it will install all jar files inside maven dependency folder

 

Installing Appium.exe and Appium.app

 

  • Click on Appium.exe (Window) or app (MAC)

Follow installation instruction

  • After installation you will get a Appium desktop sortcut
  • Double click on Appium desktop
  • Appium UI opens

 

  • Click on to start server

Server starts running on default port 4723 (window) or 4725 (MAC)

Understanding Appium Server fields functionality

  • Application path – .apk or .app path (AUT)
  • Package : Application package *
  • Wait for package: Wait to load given app package*
  • Activity: Application start activity*
  • Wait for activity: Wait to start given activity*

* Automatically populated when you browse application

  • Browser: Browser name for mobile web app
  • Launch AVD : AVD for test execution (Entry in AVD list fatch from AVD manager)
  • Device ready timeout: Appium server wait for giving time to load AVD
  • Capability: Platform Name: Test environment for window its Android/Firefox os
  • Automation name: For API-17 + it Appium and API-17- its Selendroid
  • Platform version: version on platform: 4.4.2 etc
  • Devices name: if you have not configured AVD and trying to connect read devices then you can enter UDID of device.

Write first Test class
Once you click Run as testing test file starts sending command to Appium server which is running on same port