1Confidential and propriety Galil Software, Ltd. 20124-Jan-16
Automation for Mobile Apps - Appium solution
Author:
Nael Abd Aljawad – QA Automation Technical Leader
2Confidential and propriety Galil Software, Ltd. 201225.12.11
Mobile Automation Tools Comparison
3Confidential and propriety Galil Software, Ltd. 201225.12.11
 Appium drives iOS and Android apps using the WebDriver protocol.
 Appium is an open source test automation framework for use with
native, hybrid and mobile web apps.
Appium Solution
4
What is it?
 Native App – A native app is an app which is built for a specific
platform using specific technologies like Xcode for iOS and Java for
Android.
 Hybrid App – A hybrid app is an app which uses native as well as
web technologies to bring best of both worlds.
 Html5 App – Html5 app is not installed on a phone. It runs on a
browser and built using web technologies such that it is fully
optimized for screen it runs on.
5
Features Comparison
Feature Native Hybrid HTML5
Performance Fast Controlled Slow
Multi-touch/pinch Yes Yes No
Device Access All Almost all Very few
Secure storage Yes Yes Shared/No
Connectivity Online/Offline Online/Offline Mostly Online
Rollout Slow/painful Slow/painful Fast
Security High Low Low
Best for Games/low content Medium dynamic content High dynamic content
Tools Xcode, Eclipse Phonegap, Worklight Any web based
Distribution Downloaded to device
from AppStore
Hosted on a Web server and
accessed on a Web Browser
Downloaded to device from
AppStore
Integration Supports integration with
device features such as
camera and address book
Doesn’t support integration
with device components
Supports integration with
device features such as
camera and address book
Notifications Yes No Yes
6
Market overview
 Facebook moved away from HTML5 apps
 Twitter uses hybrid app approach
 A lot of ecommerce sites have HTML5 based mobile websites
 LinkedIn also recently moved to native app
7
HTML5 vs. Hybrid vs. Native
8
Appium Philosophy
 Appium was designed to meet mobile automation needs according
to a philosophy outlined by the following four tenets:
1. You shouldn't have to recompile your app or modify it in any way in
order to automate it. you're testing the same app you're shipping
2. You shouldn't be locked into a specific language or framework to write
and run your tests
3. A mobile automation framework shouldn't reinvent the wheel when it
comes to automation APIs. extended the JSON protocol with extra
API methods useful for mobile automation
4. A mobile automation framework should be open source, in spirit and
practice as well as in name
9Confidential and propriety Galil Software, Ltd. 201225.12.11
Client/Server Architecture
 Receives connections from a client
 Listens for commands
 Executes the commands on a mobile device
 Responds with an HTTP response representing the result of the
command execution
10
Selenium
WebDriver
Script
(C#,Java,Perl,
Python,PHP)
Server written
in node.js
IDE
JSON WIRE
Protocol
via http
11Confidential and propriety Galil Software, Ltd. 201225.12.11
Appium Architecture
12Confidential and propriety Galil Software, Ltd. 201225.12.11
Session
Session Object
 Clients initiate a session with a server in ways specific to each
library
 All libraries end up sending a POST /session request to the server,
with a JSON object called the 'desired capabilities' object
 the server will start up the automation session and respond with a
session ID which is used for sending further commands
13Confidential and propriety Galil Software, Ltd. 201225.12.11
JSON
 Desired capabilities tell the Appium server what kind of automation
session we're interested in starting up
 There are various capabilities which can modify the behavior of the
server during automation (e.g. tell Appium that we want an iOS session, rather than an Android one)
Desired Capabilities
14Confidential and propriety Galil Software, Ltd. 201225.12.11
Appium
Server
Appium Server
 Appium is a server written in Node.js.
 It can be built and installed from source or installed directly from
NPM
15Confidential and propriety Galil Software, Ltd. 201225.12.11
Appium Clients
 There are client libraries which support Appium's extensions to the
WebDriver protocol. When using Appium, you want to use these
client libraries instead of your regular WebDriver client.
16
Language Clients
Github Repo and Installation InstructionsLanguage/Framework
https://github.com/appium/ruby_libRuby
https://github.com/appium/python-clientPython
https://github.com/appium/java-clientJava
https://github.com/admc/wdJavaScript (Node.js)
https://github.com/appium/selenium-objective-cObjective C
https://github.com/appium/php-clientPHP
https://github.com/appium/appium-dotnet-driverC# (.NET)
http://github.com/appium/perl-clientPerl
https://github.com/jollychang/robotframework-
appiumlibrary
RobotFramework
17Confidential and propriety Galil Software, Ltd. 201225.12.11
Mobile Star Wars
18Confidential and propriety Galil Software, Ltd. 201225.12.11
Appium GUI
19
Inspectors
 Android UIautomatorviewer / IOS UIautomation - A GUI tool to scan
and analyze the UI components of an Android/IOS application.
 Web & Hybrid apps: Chrome://inspect/#devices
20
IOS
 Versions: 6.0, 6.1, 7.0, 7.1, 8.0, and 8.1
 Devices: iPhone Simulator, iPad Simulator, and real iPhones and
iPads
 Native app support: Yes
 Mobile web support: Yes, via automation of mobile Safari.
 Hybrid support: Yes.
 Support for automating multiple apps in one session: No
 Support for automating multiple devices simultaneously: No
21
Android
 Versions: 2.3 and up
 Devices: Android emulators and real Android devices
 Native app support: Yes
 Mobile web support: Yes
 Hybrid support: Yes
 Support for automating multiple apps in one session: Yes
 Support for automating multiple devices simultaneously: Yes
22
TouchActions
23
MultiTouchActions
24
Hybrid Apps Views Switching
25
Requirements - Java
 JAVA IDE (Eclipse)
 Java JDK
 Maven Plugin for Eclipse
 Selenium WebDriver Dependencies/Appium Java-Client
Dependency (Maven)
 Android SDK
 TestNG/Junit
 Emulator/ Real Device
 Appium Server
 Node.js (If running appium from source)
 Mac OS X 10.7 or higher
 XCode >= 4.6.3
 Apple Developer Tools (iPhone simulator SDK, command line tools)
 Homebrew
26
Java JDK
 Download java JDK :
www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
to add new variable and edit the path.
right click on computer - > properties -> Advanced system settings
-> Environment variables
Add new variable :
New : variable name : JAVA_HOME
variable value : C:Program FilesJavajdk1.7.0_79
Edit Path : ;C:Program FilesJavajdk1.7.0_79bin
By Makram
27
Download Eclipse ( with TestNG & Maven)
 www.eclipse.org
 Add TestNG plugin :
Help -> install new software -> Add ->
Name : TestNG
Location : http://beust.com/eclipse
 Add Maven :
Help -> install new software -> Add ->
Name : Maven
Location : http://download.eclipse.org/technology/m2e/releases
By Makram
28
ADT Plugin
 ADT Plugin ( Android Developer Tools) :
Help -> install new software -> Add ->
Name : ADT Plugin
Location : https://dl-ssl.google.com/android/eclipse/
By Makram
29
Android SDK
Android SDK ( Software Developer Kit) :
developer.android.com/sdk/index.html
To add the location of the android sdk folder to eclipse :
Window -> Preferences -> Android
SDK Location : the path of the android-sdks
By Makram
30
ANDROID_HOME
To add new variable and edit the path.
right click on computer - > properties -> Advanced system settings
-> Environment variables
Add new variable :
New : variable name : ANDROID_HOME
variable value : pathandroid -sdks
Edit Path : ; pathandroid –sdksplatform-tools
Edit Path : ; pathandroid –sdkstools
By Makram
31
Appium
 Install Appium server :
http://appium.io/downloads.html
 Download Appium and Selenium jars from Maven repositories
Selenium : http://www.seleniumhq.org/download/
Java-client : https://search.maven.org/#search%7Cga%7C1%7Cjava-
client
By Makram
32
Test Script Development
 Create a maven project in Eclipse
 Add dependency
<dependency>
<groupId> io.appium </groupId>
<artifactId> java-client </artifactId>
<version> 1.1.0 </version>
</dependency>
33
Test Script Development
public void setUp() throws Exception
{
File classpathRoot = new File(System.getProperty("user.dir"));
File appDir = new File(classpathRoot, "../../../apps/");
File app = new File(appDir, "App_Name.apk");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName","Android");
capabilities.setCapability("browserName", "");
capabilities.setCapability("platformVersion", "4.4");
capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("appPackage", “package_name ");
capabilities.setCapability("appActivity", ".activity_name");
}
AndroidDriver driver=new AndroidDriver(new
URL("http://127.0.0.1:4723/wd/hub"), capabilities);
AppiumDriver driver = new AppiumDriver(new
URL("http://127.0.0.1:4723/wd/hub"), capabilities);
34
SauceLabs
 Automated testing in the cloud for CI.
 Provides the world’s largest cross-browser grid for executing
Selenium & Appium WebDriver tests
35
SauceLabs – Username & Access Key
36
SauceLabs - Setup
public class AppiumDriverTest {
private AppiumDriver driver;
@Parameters({"username", "key", "os", "browser", "browserVersion"})
@BeforeMethod
public void setUp(@Optional("nael_sl") String username,
@Optional("e8ea754d-c8a0-488f-993c-15f583ab2179") String key,
@Optional("mac") String os,
@Optional("iphone") String browser,
@Optional("5.0") String browserVersion,
Method method) throws Exception {
// Choose the browser, version, and platform to test
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setBrowserName(browser);
capabilities.setCapability("version", browserVersion);
capabilities.setCapability("platform", Platform.valueOf(os));
capabilities.setCapability("name", method.getName());
// Create the connection to Sauce Labs to run the tests
this.driver = new RemoteWebDriver(new URL("http://" + username + ":" + key +
"@ondemand.saucelabs.com:80/wd/hub"),capabilities);
}
@Test
public void webDriver() throws Exception {
// Make the browser get the page and check its title
driver.get("http://www.amazon.com/");
assertEquals("Amazon.com: Online Shopping for Electronics, Apparel, Computers, Books, DVDs & more",
driver.getTitle());
}
}
37
AUTOMATED TEST CONFIGURATOR
38
Android is the Winner
39Confidential and propriety Galil Software, Ltd. 201225.12.11
Drivers Relationship
40Confidential and propriety Galil Software, Ltd. 201225.12.11
Web driver FW Design
41Confidential and propriety Galil Software, Ltd. 201225.12.11
Appium Design
42Confidential and propriety Galil Software, Ltd. 201225.12.11
Current FW
43Confidential and propriety Galil Software, Ltd. 201225.12.11
Report
44Confidential and propriety Galil Software, Ltd. 201225.12.11
Thank You 
Nael Abd Aljawad – QA Automation Technical Leader

Appium solution artizone

  • 1.
    1Confidential and proprietyGalil Software, Ltd. 20124-Jan-16 Automation for Mobile Apps - Appium solution Author: Nael Abd Aljawad – QA Automation Technical Leader
  • 2.
    2Confidential and proprietyGalil Software, Ltd. 201225.12.11 Mobile Automation Tools Comparison
  • 3.
    3Confidential and proprietyGalil Software, Ltd. 201225.12.11  Appium drives iOS and Android apps using the WebDriver protocol.  Appium is an open source test automation framework for use with native, hybrid and mobile web apps. Appium Solution
  • 4.
    4 What is it? Native App – A native app is an app which is built for a specific platform using specific technologies like Xcode for iOS and Java for Android.  Hybrid App – A hybrid app is an app which uses native as well as web technologies to bring best of both worlds.  Html5 App – Html5 app is not installed on a phone. It runs on a browser and built using web technologies such that it is fully optimized for screen it runs on.
  • 5.
    5 Features Comparison Feature NativeHybrid HTML5 Performance Fast Controlled Slow Multi-touch/pinch Yes Yes No Device Access All Almost all Very few Secure storage Yes Yes Shared/No Connectivity Online/Offline Online/Offline Mostly Online Rollout Slow/painful Slow/painful Fast Security High Low Low Best for Games/low content Medium dynamic content High dynamic content Tools Xcode, Eclipse Phonegap, Worklight Any web based Distribution Downloaded to device from AppStore Hosted on a Web server and accessed on a Web Browser Downloaded to device from AppStore Integration Supports integration with device features such as camera and address book Doesn’t support integration with device components Supports integration with device features such as camera and address book Notifications Yes No Yes
  • 6.
    6 Market overview  Facebookmoved away from HTML5 apps  Twitter uses hybrid app approach  A lot of ecommerce sites have HTML5 based mobile websites  LinkedIn also recently moved to native app
  • 7.
  • 8.
    8 Appium Philosophy  Appiumwas designed to meet mobile automation needs according to a philosophy outlined by the following four tenets: 1. You shouldn't have to recompile your app or modify it in any way in order to automate it. you're testing the same app you're shipping 2. You shouldn't be locked into a specific language or framework to write and run your tests 3. A mobile automation framework shouldn't reinvent the wheel when it comes to automation APIs. extended the JSON protocol with extra API methods useful for mobile automation 4. A mobile automation framework should be open source, in spirit and practice as well as in name
  • 9.
    9Confidential and proprietyGalil Software, Ltd. 201225.12.11 Client/Server Architecture  Receives connections from a client  Listens for commands  Executes the commands on a mobile device  Responds with an HTTP response representing the result of the command execution
  • 10.
  • 11.
    11Confidential and proprietyGalil Software, Ltd. 201225.12.11 Appium Architecture
  • 12.
    12Confidential and proprietyGalil Software, Ltd. 201225.12.11 Session Session Object  Clients initiate a session with a server in ways specific to each library  All libraries end up sending a POST /session request to the server, with a JSON object called the 'desired capabilities' object  the server will start up the automation session and respond with a session ID which is used for sending further commands
  • 13.
    13Confidential and proprietyGalil Software, Ltd. 201225.12.11 JSON  Desired capabilities tell the Appium server what kind of automation session we're interested in starting up  There are various capabilities which can modify the behavior of the server during automation (e.g. tell Appium that we want an iOS session, rather than an Android one) Desired Capabilities
  • 14.
    14Confidential and proprietyGalil Software, Ltd. 201225.12.11 Appium Server Appium Server  Appium is a server written in Node.js.  It can be built and installed from source or installed directly from NPM
  • 15.
    15Confidential and proprietyGalil Software, Ltd. 201225.12.11 Appium Clients  There are client libraries which support Appium's extensions to the WebDriver protocol. When using Appium, you want to use these client libraries instead of your regular WebDriver client.
  • 16.
    16 Language Clients Github Repoand Installation InstructionsLanguage/Framework https://github.com/appium/ruby_libRuby https://github.com/appium/python-clientPython https://github.com/appium/java-clientJava https://github.com/admc/wdJavaScript (Node.js) https://github.com/appium/selenium-objective-cObjective C https://github.com/appium/php-clientPHP https://github.com/appium/appium-dotnet-driverC# (.NET) http://github.com/appium/perl-clientPerl https://github.com/jollychang/robotframework- appiumlibrary RobotFramework
  • 17.
    17Confidential and proprietyGalil Software, Ltd. 201225.12.11 Mobile Star Wars
  • 18.
    18Confidential and proprietyGalil Software, Ltd. 201225.12.11 Appium GUI
  • 19.
    19 Inspectors  Android UIautomatorviewer/ IOS UIautomation - A GUI tool to scan and analyze the UI components of an Android/IOS application.  Web & Hybrid apps: Chrome://inspect/#devices
  • 20.
    20 IOS  Versions: 6.0,6.1, 7.0, 7.1, 8.0, and 8.1  Devices: iPhone Simulator, iPad Simulator, and real iPhones and iPads  Native app support: Yes  Mobile web support: Yes, via automation of mobile Safari.  Hybrid support: Yes.  Support for automating multiple apps in one session: No  Support for automating multiple devices simultaneously: No
  • 21.
    21 Android  Versions: 2.3and up  Devices: Android emulators and real Android devices  Native app support: Yes  Mobile web support: Yes  Hybrid support: Yes  Support for automating multiple apps in one session: Yes  Support for automating multiple devices simultaneously: Yes
  • 22.
  • 23.
  • 24.
  • 25.
    25 Requirements - Java JAVA IDE (Eclipse)  Java JDK  Maven Plugin for Eclipse  Selenium WebDriver Dependencies/Appium Java-Client Dependency (Maven)  Android SDK  TestNG/Junit  Emulator/ Real Device  Appium Server  Node.js (If running appium from source)  Mac OS X 10.7 or higher  XCode >= 4.6.3  Apple Developer Tools (iPhone simulator SDK, command line tools)  Homebrew
  • 26.
    26 Java JDK  Downloadjava JDK : www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html to add new variable and edit the path. right click on computer - > properties -> Advanced system settings -> Environment variables Add new variable : New : variable name : JAVA_HOME variable value : C:Program FilesJavajdk1.7.0_79 Edit Path : ;C:Program FilesJavajdk1.7.0_79bin By Makram
  • 27.
    27 Download Eclipse (with TestNG & Maven)  www.eclipse.org  Add TestNG plugin : Help -> install new software -> Add -> Name : TestNG Location : http://beust.com/eclipse  Add Maven : Help -> install new software -> Add -> Name : Maven Location : http://download.eclipse.org/technology/m2e/releases By Makram
  • 28.
    28 ADT Plugin  ADTPlugin ( Android Developer Tools) : Help -> install new software -> Add -> Name : ADT Plugin Location : https://dl-ssl.google.com/android/eclipse/ By Makram
  • 29.
    29 Android SDK Android SDK( Software Developer Kit) : developer.android.com/sdk/index.html To add the location of the android sdk folder to eclipse : Window -> Preferences -> Android SDK Location : the path of the android-sdks By Makram
  • 30.
    30 ANDROID_HOME To add newvariable and edit the path. right click on computer - > properties -> Advanced system settings -> Environment variables Add new variable : New : variable name : ANDROID_HOME variable value : pathandroid -sdks Edit Path : ; pathandroid –sdksplatform-tools Edit Path : ; pathandroid –sdkstools By Makram
  • 31.
    31 Appium  Install Appiumserver : http://appium.io/downloads.html  Download Appium and Selenium jars from Maven repositories Selenium : http://www.seleniumhq.org/download/ Java-client : https://search.maven.org/#search%7Cga%7C1%7Cjava- client By Makram
  • 32.
    32 Test Script Development Create a maven project in Eclipse  Add dependency <dependency> <groupId> io.appium </groupId> <artifactId> java-client </artifactId> <version> 1.1.0 </version> </dependency>
  • 33.
    33 Test Script Development publicvoid setUp() throws Exception { File classpathRoot = new File(System.getProperty("user.dir")); File appDir = new File(classpathRoot, "../../../apps/"); File app = new File(appDir, "App_Name.apk"); DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("deviceName","Android"); capabilities.setCapability("browserName", ""); capabilities.setCapability("platformVersion", "4.4"); capabilities.setCapability("app", app.getAbsolutePath()); capabilities.setCapability("appPackage", “package_name "); capabilities.setCapability("appActivity", ".activity_name"); } AndroidDriver driver=new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); AppiumDriver driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
  • 34.
    34 SauceLabs  Automated testingin the cloud for CI.  Provides the world’s largest cross-browser grid for executing Selenium & Appium WebDriver tests
  • 35.
  • 36.
    36 SauceLabs - Setup publicclass AppiumDriverTest { private AppiumDriver driver; @Parameters({"username", "key", "os", "browser", "browserVersion"}) @BeforeMethod public void setUp(@Optional("nael_sl") String username, @Optional("e8ea754d-c8a0-488f-993c-15f583ab2179") String key, @Optional("mac") String os, @Optional("iphone") String browser, @Optional("5.0") String browserVersion, Method method) throws Exception { // Choose the browser, version, and platform to test DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setBrowserName(browser); capabilities.setCapability("version", browserVersion); capabilities.setCapability("platform", Platform.valueOf(os)); capabilities.setCapability("name", method.getName()); // Create the connection to Sauce Labs to run the tests this.driver = new RemoteWebDriver(new URL("http://" + username + ":" + key + "@ondemand.saucelabs.com:80/wd/hub"),capabilities); } @Test public void webDriver() throws Exception { // Make the browser get the page and check its title driver.get("http://www.amazon.com/"); assertEquals("Amazon.com: Online Shopping for Electronics, Apparel, Computers, Books, DVDs & more", driver.getTitle()); } }
  • 37.
  • 38.
  • 39.
    39Confidential and proprietyGalil Software, Ltd. 201225.12.11 Drivers Relationship
  • 40.
    40Confidential and proprietyGalil Software, Ltd. 201225.12.11 Web driver FW Design
  • 41.
    41Confidential and proprietyGalil Software, Ltd. 201225.12.11 Appium Design
  • 42.
    42Confidential and proprietyGalil Software, Ltd. 201225.12.11 Current FW
  • 43.
    43Confidential and proprietyGalil Software, Ltd. 201225.12.11 Report
  • 44.
    44Confidential and proprietyGalil Software, Ltd. 201225.12.11 Thank You  Nael Abd Aljawad – QA Automation Technical Leader

Editor's Notes

  • #4 A native application (native app) is an application program that has been developed for use on a particular platform or device. (Ingress, Instagram…) A Web application (Web app) is an application program that is stored on a remote server and delivered over the Internet through a browser interface.(Designer Pages, Wistia ,Wufoo) A hybrid application (hybrid app) is one that combines elements of both native and Web applications.(Facebook - Three20 as the core UI along with the Facebook SDK but HTML5 for feeds)
  • #9 http://appium.io/introduction.html
  • #14 JavaScript Object Notation (JSON) is used to represent objects with complex data structures. It is used primarily to transfer data between a server and a client on the web. It has very much become an industry standard for various REST web services, playing a strong alternative to XML. A client can send a person’s details to a server in the preceding JSON format, which the server can parse and create an instance of the Person object for use in its execution. Later, the response can be sent back by the server to the client in the JSON format, the data of which the client can use to create an object of a class.
  • #15 Npm: package manager that makes it easy for JavaScript developers to share and reuse code, and it makes it easy to update the code that you're sharing. Node.js: is an open source, cross-platform runtime environment for server-side and networking applications. Node.js applications are written in JavaScript, and can be run within the Node.js runtime on OS X, Microsoft Windows, Linux, FreeBSD, NonStop, IBM AIX,IBM System z and IBM i. Its work is hosted and supported by the Node.js Foundation,[3] a Collaborative Project at Linux Foundation.
  • #17 http://appium.readthedocs.org/en/stable/en/about-appium/appium-clients/
  • #35 https://docs.saucelabs.com/tutorials/appium/