Date post: | 07-Aug-2015 |
Category: |
Technology |
Upload: | amit-rawat |
View: | 145 times |
Download: | 1 times |
Appium: Mobile Automation Made Awesome
AGENDA
Introduction to Mobile Automation $ Why Appium??
Mobile Web Automation using Appium
iOS Native Apps Automation
Android Native Apps Automation
MOBILE TESTING MYTHS• Testing on Emulator is enough
• Testing on 4 to 5 most common devices is enough
• Exploratory testing just before the launch is enough
• Users will understand if there are some issues in the app
NOW SOME MOBILE TESTING FACTS
• Application not working and having bugs is #1 reason for uninstalling the app.
• Quality reasons are #1 reason for bad reviews in Marketplace(80%). Application content related issues are only 20%
• 60% of mobile users will abandon your app or site if it doesn’t load with in 3 seconds. Three seconds! Of those users, 43% said they would ever return to your app or site.
• 32% of the users reports a negative review on the marketplace for every crash they face.
WHY MOBILE AUTOMATION REQUIRED???• Multiple platforms (iOS, Android, Windows, Blackberry)
• Multiple OEMs (Samsung,Apple,LG,Motorola,Sony and many more)
• Different screen resolutions
• Cost of a leaked defect is quite high
• Frequent releases of the apps
• Any changes in the app needs testing of the whole app
• Different Network types(2G,3G,4G,Wifi)
• Quality apps can only sustain in such enormous Appstores/Markets
AUTOMATIONS PARADIGMS : UI INTERACTION
VISUAL PROGRAMMATIC
No Interaction with application code Use application code to interact with UI elements
Verify appearance of UI elements Verify presence and state of UI elements
Beware of intended visual changes like screen resolution
Beware of code changes that don’t affect layout of element properties
AUTOMATIONS PARADIGMS : COMMUNICATION
USB(Lab) HTTP(User Agent)
Tool interacts with the application via USB Tool interacts with the application via http request
Dependency on the native APIs offered by the platform
Tool and the mobile device should be in same network
No modifications in the app are required App needs to be modified to place http listener inside it.
NEW PARADIGM: MOBILE AUTOMATION ROBOT
TAPSTER
TOOLS AVAILABLE
Paid/Licensed:
Calabash Android MonkeyTalk Robotium UIAutomator Selendroid Sikuli Appium Espresso
Open Source:
Ranorex Perfecto Mobile Cloud DeviceAnyWhere TestObject SeeTest Eggplant TenKod
WHAT TO LOOK IN A MOBILE AUTOMATION TOOL• Native, Hybrid and Mobile Web Support
• On-Demand Cloud Testing
• Integration with Key Support Systems
• Cross Platform Support
• Scalability
WHY APPIUM ?
WHY APPIUM ?
APPIUM’S HIGH LEVEL ARCHITECTURE
Selenium WebDriver Script
(C#,Java,Perl,Python,PHP)
Server written in node.js
IDE
JSON WIRE Protocol via http
UIAutomation
request via
USB
UIAutomator/Selendroid
request via USB
APPIUM’S ARCHITECTURE
Appium is an HTTP server that creates and handles WebDriver sessions
Appium starts a “test case” on the device that spawns a server and listens for proxied commands.
On iOS appium proxies commands to a UIAutomation script running in Instruments
On Android, appium proxies commands to a UiAutomator test case running on the device
ARCHITECTURE - IOS
ARCHITECTURE - ANDROID
APPIUM ROADMAP• Architectural Changes• Apple Watch Support• Better Documentation• Re-building Appium GUI with ‘Electron’ to have a single code
base• Replacing UIAutomator with DroidDriver• Plans to have a non-UIAutomation iOS backend (Calabash)
APPIUM REQUIREMENTS• Mac 10.9+ with XCode and iOS SDK
• Android SDK with emulators
• Node.js + NPM
• Java
• Appium Client in your language
• Test Runner in your language
MOBILE WEB AUTOMATION ON ANDROID
MOBILE WEB AUTOMATION ON IOS
IOS NATIVE APPS AUTOMATION
Please visit: http://careers.3pillarglobal.com/
BREAK TIME!!!
Android Native App Automation
Using Appium (Java Client)
Start with APK
• Sign APK With Own
Certificate
• Android Driver And
Mandatory
Capabilities
• APK Installation &
Uninstallation
SDK Tools Utilization• Ui Automator Viewer• How To Locate Element.• Important ADB Commands• Monitor• Identify Package And Activity
Name
APK Features Coverage• Launch, Reset And Close App• Mobile Gestures (Scroll, Tap ,
Swipe, Rotate)• Hide Keyboard And Lock Screen• Switch b/w Native And Web
View• Geo Location Setting• Run App In Background• Switch B/W Different Apk• Upload And Download File
INDEX
START WITH APK
Sign APK With Own Certificate
Android Driver And Mandatory Capabilities
APK Installation & Uninstallation
SDK TOOLS UTILIZATION
UI AUTOMATOR1- WHY WE NEED2- WHERE TO FIND3- HOW TO USE
HOW TO LOCATE ELEMENT
IMPORTANT ADB COMMANDSadb devices adb pull –p <remote> <local>adb install <file> adb push –p <local> <remote>
adb uninstall <package> adb start-serveradb kill-server adb get-state ( offline | bootloader | device)adb status-window adb root
Identify Package And Activity Nameaapt dump badging <path-to-apk> | grep “package:\ name”
Monitor adb logcat –d adb logcat –f <fileName> -r 1024 –n 8 (leave it running)
APK FEATURES COVERAGE
Launch, Reset, Close and Remove App
Switch B/W Native And Web View
Geo Location Setting and UI Automator directly
Hide Keyboard, Lock Screen and Run App in background
Switch b/w different Apps
Upload And Download File
Mobile Gestures (Scroll, Tap, Swipe, Rotate)
Andr
oid
Driv
er
Launch(), Reset(), closeApp(), removeApp(bundleId);
getContextHandles(), getContext()
setLocation(Location), new UiSelector().className(\"EditText\")
hideKeyboard(), lockScreen(timeInSecond)
runAppInBackground(timeInSecond)
new AndroidDriver(URL, Capabilities)
pullFile, pullFolder(remotepath), pushFile()
Tap, Swipe, rotate,scrollTo, scrollToExact
Q & A
References: http://devops.com/2015/06/23/choosing-mobile-test-automation-solution-need-know/
• https://viennamobilequalitycrew.wordpress.com/2015/04/13/interview-mit-dan-cuellar-thedancuellar-a-closer-look-at-appium/
• https://www.dropbox.com/s/rhuma8nvmwsurjw/ltg-workshop.pdf?dl=0
• https://github.com/appium/appium/blob/master/ROADMAP.md