Appium
-
Upload
anuradha-malalasena -
Category
Technology
-
view
78 -
download
0
Transcript of Appium
Automation for Apps
Anuradha Malalasena
Agenda What is Appium Getting Started with Appium
Setting up test environment Node Installation and Appium GUI
Demo Windows Automation Android Automation
Native App Hybrid App Mobile Web
References
Let’s meet Appium
What is Appium Appium is an open-source tool for automating native, mobile web, and
hybrid applications. "Appium" is selenium-like testing framework that implements the
"WebDriver" protocol. Supports iOS, Android and Windows Platforms
Appium Philosophy1. You shouldn’t have to recompile your app or modify it in any way in order to
automate it.
2. You shouldn’t be locked into a specific language or framework to write and run your tests.
WebDriver specifies a client-server protocol (client can written in any language) Free to use whatever test runner and test framework
3. A mobile automation framework shouldn’t reinvent the wheel when it comes to automation APIs.• WebDriver has become the standard for automating web browsers
4. A mobile automation framework should be open source, in spirit and practice as well as in name!
Appium Architecture - Client/Server Appium is a webserver that exposes a REST API. It receives connections from a client, listens for commands, executes those
commands on a mobile device, and responds with an HTTP response representing the result of the command execution.
Appium is a server written in Node.js. It can be built and installed from source or directly from NPM.
There are client libraries (in Java, Ruby, Python, PHP, JavaScript, and C#) which support Appium’s extensions to the WebDriver protocol.
Appium Architecture - Session Automation is always performed in the context of a session. Clients initiate a session with a server in ways specific to each library, BUT they all end up sending a 'POST /session' request to the server, with a
JSON object called the ‘Desired Capabilities’. After that, Server will start up the automation session and respond with a
session ID which can be used in sending further commands.
Appium Architecture - Desired Capabilities
Desired capabilities are sets of keys and values sent to the Appium server to tell the server what kind of automation session we’re interested in starting up.
Appium Architecture - iOS
bootstrap.jsApple Instruments
Appium Architecture - Android
bootstrap.jar
UIAutomator
Android 2.3+
Android 4.2+
Appium Architecture - Windows
WinAppDriver
Windows 10 PC
Appium Architecture – JSONWP JSON wire protocol (JSONWP) is a transport mechanism created by
WebDriver developers. predefined, standardized endpoints exposed via a RESTful API
Appium implements the Mobile JSONWP, the extension to the Selenium JSONWP /session/:sessionId/element /session/:sessionId/elements /session/:sessionId/element/:id/click
Desired CapabilitiesCapability Details
automationName Android SDK version less than 17, then you need to define the value as Selendroid; otherwise, the capability takes the default value as Appium.
platformName iOS, Android, FirefoxOS, WindowsplatformVersion OS version of the device deviceName Type of device ( Android Emulator, Moto x, Nexus 5)App Absolute local path or remote HTTP URL of the .ipa,.apk, or .zip file.browserName If you want to automate mobile web applications, then you have to
use this capability to define the browser.
http://appium.io/slate/en/master/?csharp#appium-server-capabilities
Desired Capabilities - AndroidCapability Details
appPackage Java package of the Android app that you want to run
appActivity Android activity that you want to launch
Avd Name of avd that you want to launch
http://appium.io/slate/en/master/?csharp#android-only
How to get .apk info Already Installed
Plug the device Adb shell dumpsys window windows | grep –E 'mCurrentFocus|mFocusedApp‘
Have .apk file Use Appium GUI
Desired Capabilities - iOS
http://appium.io/slate/en/master/?csharp#ios-only
Desired Capabilities - Windows
http://appium.io/slate/en/master/?csharp#winappdriver-only
Get Ready!
System Requirements – Android on Windows
JDK (version 7 or later) Android SDK API (version 17 or later) Android Virtual Device (AVD) or real device
Appium installation – Android on Windows
Install JDK Setup JAVA_HOME and Path variables
Install Android SDK Setup ANDRIOD_HOME variables
Appium on Node.js or Appium.exe Android Virtual Device (AVD) or Real Device Enable USB Debugging
System Requirements – iOS Mac OS X 10.7 or later Xcode Java version 7 or later Homebrew Node and npm
System Requirements – Windows Windows 10 Anniversary Edition or higher Enable Developer Mode Windows SDK WinAppDriver (Appium 1.6 or higher)
Play Time!
Starting Appium Server Appium GUI
Appium 1.4 (only Android and iOS) Appium with Node.js
Appium 1.6 (including Windows support) WinAppDriver
Appium GUI This is a GUI wrappers around the Appium
server. These come bundled with everything required
to run the Appium server (including Node.Js). It has inbuilt Inspector, which enables to find
out elements.
Appium with Node.js $ npm install -g appium $ appium
WinAppDriver.exe
Inspecting Elements Appium Inspector (Appium GUI)
Pre-launch the App Android ‘uiautomatorviewer.bat’ (Android SDK) Windows ‘inspect.exe’ (Windows SDK) Chrome Inspector – Remote Devices (WebView App / Mobile Web)
setWebContentsDebuggingEnabled flag set to true
Write the Script Any WebDriver compatible language
Ruby Python Java JavaScript PHP C# RobotFramework
Any IDE Any Testing Framework
Write the Script - Demo Language - C# IDE - Visual Studio 2015 Testing Framework - Visual Studio Unit Testing Framework
Demo – Windows
Demo – Mobile Web
Demo – Android Native
Demo – Android Hybrid
References http://appium.io/slate/en/master/?csharp#introduction-to-appium
References
Questions ?
Thank You !