Appium
Sunket Ingale
 ISTQB Certified Tester, CP-BAT (Certified Professional Basic Agile
Testing) and CP-SAT (Certified Professional Selenium Automation
Testing)
 Completed multiple end to end projects using QTP for large Capital
Market Company and exchange. Architected framework integrating
QTP, Selenium, Test Complete.
 Conducted multiple corporate and public training programs in QTP,
Selenium, TestComplete and SoapUI.
 More than 5 years of Industry experience
 Bachelor Degree in Software Engineering, Aston University, UK
Sunket has good experience in preparing and executing automation scripts, test data preparation, client
coordination, defect reporting, defect management, peer review. Sunket has worked in Automation projects
which included leading automation team and architecting automation framework. Sunket has worked on
following domains – Electronic trading technologies, OMS (Order Management Systems), RMS(Risk
Management Systems). Sunket has worked as a lead automation consultant in Edelweiss’ OMS/RMS
automation project using TestComplete which required integration and synchronization of multiple trading
systems. Sunket has multiple automation frameworks using TestComplete. Additional experience includes
Mobile App Testing (Appium), Android application development. Sunket has a passion on training and
mentoring and keeps on taking public and corporate training programs as and when time permits.
Sunket Ingale – Consultant Test Automation
Appium Introduction
• Appium is an automation tool used for
automating native, mobile web, and hybrid
applications on iOS and Android platforms
• Developed by Sauce Labs
• APPIUM is a freely distributed open source
mobile application UI testing framework.
• Appium allows native, hybrid and web
application testing and supports automation
test on physical devices as well as on emulator
or simulator both.
• It offers cross-platform application testing i.e.
single API works for both Android and iOS
platform test scripts
• It has NO dependency on Mobile device OS
• Appium supports all languages that have
Selenium client libraries like- Java, Objective-
C, JavaScript with node.js, PHP, Ruby, Python,
C# etc.
Appium Design Concepts
• Appium is an 'HTTP Server' written using Node.js platform
and drives iOS and Android session using WebDriver JSON
wire protocol. Hence, before initializing the Appium Server,
Node.js must be pre-installed on the system.
• When Appium is downloaded and installed, then a server is
setup on our machine that exposes a REST API
• It receives connection and command request from the
client and execute that command on mobile devices
• It responds back with HTTP responses. Again, to execute
this request, it uses the mobile test automation
frameworks to drive the user interface of the apps
Prerequisites
• Android sdk
• JDK
• Eclipse
• TestNG
• Appium
• Node.js
• Selenium jars
• ‘APK info’ App
Installation and Configuration
• Setting Java Environment Variables
• Install Node.js
• Install Android SDK
• Set SDK environment variables (sdk,platform-
tools,tools)
• Install Appium
• Enable USB Debugging
• Install ‘APK info’ app
• Setting Desired Capabilities
• APK Files, appPackage, appActivity
• Find appPackage and appActivity without APK
info
- type adb shell in cmd
- dumpsys window windows | grep –E
‘mCurrent|mFocusedApp’
API Levels
• API Level is an integer value that uniquely
identifies the framework API revision offered by a
version of the Android platform
• Appium requires API level 17 or above. i.e. Jelly
Bean (4.2 or higher)
• Android devices before version 4.2 (API Level
17) do not have Google’s UiAutomator
framework installed
• Appium comes bundled with another automation
backend called Selendroid.
Code name Version number Initial release date API level
N/A
1.0 September 23, 2008 1
1.1 February 9, 2009 2
Cupcake 1.5 April 27, 2009 3
Donut 1.6 September 15, 2009 4
Eclair 2.0 – 2.1 October 26, 2009 5 – 7
Froyo 2.2 – 2.2.3 May 20, 2010 8
Gingerbread 2.3 – 2.3.7 December 6, 2010 9 – 10
Honeycomb[a] 3.0 – 3.2.6 February 22, 2011 11 – 13
Ice Cream Sandwich 4.0 – 4.0.4 October 18, 2011 14 – 15
Jelly Bean 4.1 – 4.3.1 July 9, 2012 16 – 18
KitKat 4.4 – 4.4.4 October 31, 2013 19 – 20
Lollipop 5.0 – 5.1.1 November 12, 2014 21 – 22
Marshmallow 6.0 – 6.0.1 October 5, 2015 23
Nougat 7.0 August or September 2016 24
Selendroid
• Selendroid is a test automation framework for
multi type of mobile
application: native and hybrid android app
and mobile web.
• Corresponding to the Android API version up,
Selendroid also supports the new Android API
(From API 10 to API 19)
• Selendroid also has some built in inspector tool
to help you identify the UI element of application
under test
Selendroid features
• Selendroid test app can interact with multiple devices
or simulators simultaneously. It's a great advantage of
Selendroid. So you can test your app with various
android devices to check compatibility.
• Selendroid can simulate human-user actions on an app,
such as touch, swipe, drag and drop on devices
• You can change the hardware devices (Plug and
unplug) during the testing without restarting or
stopping the test. Selendroid recognizes the new
devices automatically
• Web Driver Client – The Java client library based
on Selenium. This library should be installed on
the computer (which is used to develop the test
cases)
• Selendroid-Server – The server which runs be in
the app under test on Android device or
simulator. This is the main components of
Selendroid architecture
• Android Driver-App - A built in Android driver,
Web View app to test the mobile web.
• Selendroid-Standalone – This component is used
to install the Selendroid server and the
application under test (AUT)
Running a sample test
• Run a sample test on mobile.
Locator Strategies
• Using UI Automator
• Locating Attributes in UI Automator
• Ways to define Xpath for complex elements
Xpath Example
• Syntax: //ClassName[@attribute=‘Value’]
• Eg: //android.widget.Button[@text='Log in']
Appium Specific Functions
• Zoom
 ((MobileElement)(element)).zoom();
• Taps
 driver.tap(1,80,194,1);
• Multi-Touch
 MultiTouchAction multiTouch = new
MultiTouchAction(driver);
TouchAction action0 = new TouchAction(driver).tap(el);
TouchAction action1 = new TouchAction(driver).tap(el);
multiTouch.add(action0).add(action1).perform();
• Swipe
Swipe from Right to Left.
driver.swipe(startx, starty, endx, starty, 3000);
Swipe from Left to Right.
driver.swipe(endx, starty, startx, starty, 3000);
• Switching Apps
driver.startActivity("com.android.mms",
"com.android.mms.ui.RoamingGuardPopupActivity
");
Native App Test
• Making a Call
• Adding Contacts
• Sending SMS
• Automating the Calculator
Appium Grid
• Grid Concept
• Testing in parallel
• Creating JSON files for nodes and hub
• Connecting real devices and emulators
• Desired Capabilities
POM and PFC
• @AndroidFindBy, @AndroidFindBys
• @IOSFindBy, @IOSFindBys
Thank You
sunket.ingale@qaagility.com

ATAGTR2017 Appium

  • 1.
  • 2.
    Sunket Ingale  ISTQBCertified Tester, CP-BAT (Certified Professional Basic Agile Testing) and CP-SAT (Certified Professional Selenium Automation Testing)  Completed multiple end to end projects using QTP for large Capital Market Company and exchange. Architected framework integrating QTP, Selenium, Test Complete.  Conducted multiple corporate and public training programs in QTP, Selenium, TestComplete and SoapUI.  More than 5 years of Industry experience  Bachelor Degree in Software Engineering, Aston University, UK Sunket has good experience in preparing and executing automation scripts, test data preparation, client coordination, defect reporting, defect management, peer review. Sunket has worked in Automation projects which included leading automation team and architecting automation framework. Sunket has worked on following domains – Electronic trading technologies, OMS (Order Management Systems), RMS(Risk Management Systems). Sunket has worked as a lead automation consultant in Edelweiss’ OMS/RMS automation project using TestComplete which required integration and synchronization of multiple trading systems. Sunket has multiple automation frameworks using TestComplete. Additional experience includes Mobile App Testing (Appium), Android application development. Sunket has a passion on training and mentoring and keeps on taking public and corporate training programs as and when time permits. Sunket Ingale – Consultant Test Automation
  • 3.
    Appium Introduction • Appiumis an automation tool used for automating native, mobile web, and hybrid applications on iOS and Android platforms • Developed by Sauce Labs • APPIUM is a freely distributed open source mobile application UI testing framework.
  • 4.
    • Appium allowsnative, hybrid and web application testing and supports automation test on physical devices as well as on emulator or simulator both. • It offers cross-platform application testing i.e. single API works for both Android and iOS platform test scripts • It has NO dependency on Mobile device OS • Appium supports all languages that have Selenium client libraries like- Java, Objective- C, JavaScript with node.js, PHP, Ruby, Python, C# etc.
  • 5.
    Appium Design Concepts •Appium is an 'HTTP Server' written using Node.js platform and drives iOS and Android session using WebDriver JSON wire protocol. Hence, before initializing the Appium Server, Node.js must be pre-installed on the system. • When Appium is downloaded and installed, then a server is setup on our machine that exposes a REST API • It receives connection and command request from the client and execute that command on mobile devices • It responds back with HTTP responses. Again, to execute this request, it uses the mobile test automation frameworks to drive the user interface of the apps
  • 6.
    Prerequisites • Android sdk •JDK • Eclipse • TestNG • Appium • Node.js • Selenium jars • ‘APK info’ App
  • 7.
    Installation and Configuration •Setting Java Environment Variables • Install Node.js • Install Android SDK • Set SDK environment variables (sdk,platform- tools,tools) • Install Appium • Enable USB Debugging • Install ‘APK info’ app
  • 8.
    • Setting DesiredCapabilities • APK Files, appPackage, appActivity • Find appPackage and appActivity without APK info - type adb shell in cmd - dumpsys window windows | grep –E ‘mCurrent|mFocusedApp’
  • 9.
    API Levels • APILevel is an integer value that uniquely identifies the framework API revision offered by a version of the Android platform • Appium requires API level 17 or above. i.e. Jelly Bean (4.2 or higher) • Android devices before version 4.2 (API Level 17) do not have Google’s UiAutomator framework installed • Appium comes bundled with another automation backend called Selendroid.
  • 10.
    Code name Versionnumber Initial release date API level N/A 1.0 September 23, 2008 1 1.1 February 9, 2009 2 Cupcake 1.5 April 27, 2009 3 Donut 1.6 September 15, 2009 4 Eclair 2.0 – 2.1 October 26, 2009 5 – 7 Froyo 2.2 – 2.2.3 May 20, 2010 8 Gingerbread 2.3 – 2.3.7 December 6, 2010 9 – 10 Honeycomb[a] 3.0 – 3.2.6 February 22, 2011 11 – 13 Ice Cream Sandwich 4.0 – 4.0.4 October 18, 2011 14 – 15 Jelly Bean 4.1 – 4.3.1 July 9, 2012 16 – 18 KitKat 4.4 – 4.4.4 October 31, 2013 19 – 20 Lollipop 5.0 – 5.1.1 November 12, 2014 21 – 22 Marshmallow 6.0 – 6.0.1 October 5, 2015 23 Nougat 7.0 August or September 2016 24
  • 11.
    Selendroid • Selendroid isa test automation framework for multi type of mobile application: native and hybrid android app and mobile web. • Corresponding to the Android API version up, Selendroid also supports the new Android API (From API 10 to API 19) • Selendroid also has some built in inspector tool to help you identify the UI element of application under test
  • 12.
    Selendroid features • Selendroidtest app can interact with multiple devices or simulators simultaneously. It's a great advantage of Selendroid. So you can test your app with various android devices to check compatibility. • Selendroid can simulate human-user actions on an app, such as touch, swipe, drag and drop on devices • You can change the hardware devices (Plug and unplug) during the testing without restarting or stopping the test. Selendroid recognizes the new devices automatically
  • 13.
    • Web DriverClient – The Java client library based on Selenium. This library should be installed on the computer (which is used to develop the test cases) • Selendroid-Server – The server which runs be in the app under test on Android device or simulator. This is the main components of Selendroid architecture • Android Driver-App - A built in Android driver, Web View app to test the mobile web. • Selendroid-Standalone – This component is used to install the Selendroid server and the application under test (AUT)
  • 14.
    Running a sampletest • Run a sample test on mobile.
  • 15.
    Locator Strategies • UsingUI Automator • Locating Attributes in UI Automator • Ways to define Xpath for complex elements
  • 17.
    Xpath Example • Syntax://ClassName[@attribute=‘Value’] • Eg: //android.widget.Button[@text='Log in']
  • 18.
    Appium Specific Functions •Zoom  ((MobileElement)(element)).zoom(); • Taps  driver.tap(1,80,194,1); • Multi-Touch  MultiTouchAction multiTouch = new MultiTouchAction(driver); TouchAction action0 = new TouchAction(driver).tap(el); TouchAction action1 = new TouchAction(driver).tap(el); multiTouch.add(action0).add(action1).perform();
  • 19.
    • Swipe Swipe fromRight to Left. driver.swipe(startx, starty, endx, starty, 3000); Swipe from Left to Right. driver.swipe(endx, starty, startx, starty, 3000); • Switching Apps driver.startActivity("com.android.mms", "com.android.mms.ui.RoamingGuardPopupActivity ");
  • 20.
    Native App Test •Making a Call • Adding Contacts • Sending SMS • Automating the Calculator
  • 21.
    Appium Grid • GridConcept • Testing in parallel • Creating JSON files for nodes and hub • Connecting real devices and emulators • Desired Capabilities
  • 22.
    POM and PFC •@AndroidFindBy, @AndroidFindBys • @IOSFindBy, @IOSFindBys
  • 23.