Title: Appium Automation for Mac OS X. Created By: Prithivirajan M. Abstract. Introduction



Similar documents
Appium mobile test automation

Silk Test Testing Mobile Applications

International Journal of Advanced Engineering Research and Science (IJAERS) Vol-2, Issue-11, Nov- 2015] ISSN:

Example Connection between USB Host and Android

The "Eclipse Classic" version is recommended. Otherwise, a Java or RCP version of Eclipse is recommended.

MOBILE APPS. QA Testing for mobile applications

01. Introduction of Android

Android Environment SDK

Wireless Presentation Gateway. User Guide

Android Environment SDK

Android Setup Phase 2

Islamic University of Gaza. Faculty of Engineering. Computer Engineering Department. Mobile Computing ECOM Eng. Wafaa Audah.

Android Programming and Security

How To Use Titanium Studio

Introduction to Android Development

IBM TRIRIGA Anywhere Version 10 Release 4. Installing a development environment

Choosing a Mobile Application Development Approach

Android Programming. Høgskolen i Telemark Telemark University College. Cuong Nguyen,

SBBWU PROXY SETTING IT CENTRE How to Set a Proxy Server in All Major Internet Browsers for Windows

How To Develop An Android App On An Android Device

XenMobile Logs Collection Guide

Develop a Native App (ios and Android) for a Drupal Website without Learning Objective-C or Java. Drupaldelphia 2014 By Joe Roberts

Running a Program on an AVD

Setting up Sudoku example on Android Studio

Developing for MSI Android Devices

Oracle FLEXCUBE Direct Banking Android Tab Client Installation Guide Release

Fahim Uddin 1. Java SDK

Mobile Application Development

To set up your Android with Good for Enterprise:

Cross-Platform Development

geniusport mobility training experts

CS378 -Mobile Computing. Android Overview and Android Development Environment

Android Programming: Installation, Setup, and Getting Started

Adobe Summit 2015 Lab 712: Building Mobile Apps: A PhoneGap Enterprise Introduction for Developers

Getting Started with Android Development

Hello World. by Elliot Khazon

Generate Android App

Android Mobile App Building Tutorial

Board also Supports MicroBridge

PC Requirements and Technical Help. Q1. How do I clear the browser s cache?

Advantages. manage port forwarding, set breakpoints, and view thread and process information directly

Android 5.0: Lollipop OS

Developing Android Applications Introduction to Software Engineering Fall Updated 7 October 2015

How To Run A Hello World On Android (Jdk) On A Microsoft Ds.Io (Windows) Or Android Or Android On A Pc Or Android 4 (

With a single download, the ADT Bundle includes everything you need to begin developing apps:

What else can you do with Android? Inside Android. Chris Simmonds. Embedded Linux Conference Europe Copyright 2010, 2net Limited.

Lab 0 (Setting up your Development Environment) Week 1

Getting Started with VMware Horizon View (Remote Desktop Access)

place/business fetch details, removefromfavorite () function, 189 search button handler bind, B BlackBerry build environment

ADT Plugin for Eclipse

Silk Test Testing Mobile Web Applications

Build a Mobile App in 60 Minutes with MAF

Developing In Eclipse, with ADT

Installing the Android SDK

How to Set Up Your PC for Android Application Development

WA1826 Designing Cloud Computing Solutions. Classroom Setup Guide. Web Age Solutions Inc. Copyright Web Age Solutions Inc. 1

Software Development Environment. Installation Guide

Penetration Testing for iphone Applications Part 1

Homework 9 Android App for Weather Forecast

Introduction: The Xcode templates are not available in Cordova or above, so we'll use the previous version, for this recipe.

-Android 2.3 is the most used version of Android on the market today with almost 60% of all Android devices running 2.3 Gingerbread -Winner of

Operational Decision Manager Worklight Integration

OpenCV on Android Platforms

New Technology Introduction: Android Studio with PushBot

Kony MobileFabric Messaging. Demo App QuickStart Guide. (Building a Sample Application

Android Development Tools for Eclipse

unisys ClearPath eportal Developer 6.1 Unisys Multi-Device App Developer s Guide March

Technology Services Group Procedures. IH Anywhere guide. 0 P a g e

Download and Installation Instructions. Android SDK and Android Development Tools (ADT)

Android Development Setup [Revision Date: 02/16/11]

Tutorial: Android Object API Application Development. SAP Mobile Platform 2.3 SP02

PARK UNIVERSITY. Information Technology Services. VDI In-A-Box Virtual Desktop. Version 1.1

ThinPoint Quick Start Guide

Installing Ruby on Windows XP

CSA Software Listing Table of Contents. Both Windows and Mac platforms are supported.

Università Degli Studi di Parma. Distributed Systems Group. Android Development. Lecture 1 Android SDK & Development Environment. Marco Picone

Frequently Asked Questions for logging in to Online Banking

BROWSER AND SYSTEM REQUIREMENTS

Building graphic-rich and better performing native applications. Pro. Android C++ with the NDK. Onur Cinar

UP L18 Enhanced MDM and Updated Protection Hands-On Lab

mystanwell.com Installing Citrix Client Software Information and Business Systems

Henry Ford Health System Citrix Access Gateway Support Details

How to Install Applications (APK Files) on Your Android Phone

Android Architecture. Alexandra Harrison & Jake Saxton

Medstar Health Dell Services

1) SETUP ANDROID STUDIO

Instructions for Configuring Your Browser Settings and Online Security FAQ s. ios8 Settings for iphone and ipad app

VPN User Guide. For Mac

ios App for Mobile Website! Documentation!

Lab 4 In class Hands-on Android Debugging Tutorial

Connecting With Lifesize Cloud

Android: Setup Hello, World: Android Edition. due by noon ET on Wed 2/22. Ingredients.

About this Release. Introduction. Prerequisites. Installation. Using the Web SDK Packager

NETGEAR genie Apps. User Manual. 350 East Plumeria Drive San Jose, CA USA. August v1.0

Enable Your Automated Web App Testing by WebDriver. Yugang Fan Intel

EasyPush Push Notifications Extension for ios

How to use the VMware Workstation / Player to create an ISaGRAF (Ver. 3.55) development environment?

Time Machine Setup for Routers

Initial Setup of Microsoft Outlook 2011 with IMAP for OS X Lion

Transcription:

Title: Appium Automation for Mac OS X Created By: Prithivirajan M Abstract This document aims at providing the necessary information required for setting up mobile testing environment in Mac OS X for testing the Android applications and ios applications using the test automation framework Appium. Following are the steps which covers the basic setup for running the Android applications (.apk) and ios applications (.app) in Emulator (Android only), Simulator (ios only) and also in respective real devices. Introduction One should familiarise with the following terms prior to setting up the environment and running the automation tests in handheld devices or in emulator and simulator. Test Automation: Test automation is use of a program to control the execution of tests, comparison of actual outcomes to predicted outcomes, setting up of test pre-conditions and other test control and test reporting functions. The objective of automated testing is to simplify as much of the testing effort as possible with a minimum set of scripts. A test automation will address the limitations of traditional manual testing and record/playback automation and also will ensure Re-usability, Maintainability, Flexibility, Reliability, Robustness and Portability of the scripts. Appium: Appium is an open source automation testing tool written in Node.js. It is cross platform, hence it allows to write tests in multiple platforms (ios, Android and FirefoxOS). Using Appium native apps, web apps and hybrid apps can be tested in emulators, simulators and real devices. It drives the apps using the Webdriver JSON wire protocol. Native App: These are the apps are the typical apps which we download from either App Store or Google Play, they get installed within your device s applications and you launch them by tapping their icon. Web App: In one line, web apps are the mobile version of websites. Web apps loads within a mobile browser, like Safari or Chrome, like every other website.

Hybrid App: This is the app run on device rather than a browser and are built using the web technologies like HTML5, CSS and Javascript. Emulator & Simulator: The virtual devices which duplicates the features and functionalities in the aim to replicate the behaviours of Actual (Real) devices. Emulators are the virtual devices for the Android and FirefoxOS, while Simulators are for the ios. API Level: API Level is an integer value that uniquely identifies the API revision of Android platform. Appium supports from API level 9 through the latest level. Below table below specifies the API Level supported by each version of the Android platform. Platform Version API Level Version Code Android 5.0 21 LOLLIPOP Android 4.4W 20 KITKAT_WATCH Android 4.4 19 KITKAT Android 4.3 18 JELLY_BEAN_MR2 Android 4.2, 4.2.2 17 JELLY_BEAN_MR1 Android 4.1, 4.1.1 16 JELLY_BEAN Android 4.0.3, 4.0.4 15 ICE_CREAM_SANDWICH_MR1 Android 4.0, 4.0.1, 4.0.2 14 ICE_CREAM_SANDWICH Android 3.2 13 HONEYCOMB_MR2 Android 3.1.x 12 HONEYCOMB_MR1 Android 3.0.x 11 HONEYCOMB Android 2.3.4, 2.3.3 10 GINGERBREAD_MR1 Android 2.3.2, 2.3.1, 2.3 9 GINGERBREAD Android 2.2.x 8 FROYO Android 2.1.x 7 ECLAIR_MR1 Android 2.0.1 6 ECLAIR_0_1 Requirements Android 2.0 5 ECLAIR Android 1.6 4 DONUT Android 1.5 3 CUPCAKE Android 1.1 2 BASE_1_1 Android 1.0 1 BASE Mac OS X 10.7 or higher ADT Bundle for Mac

Eclipse or similar IDEs Appium (recommended latest version) Java 7 or higher Xcode (recommended latest version) Getting Started Emulator 1. Step up ANROID_HOME and PATH variables in.bash_profile as follows : Open terminal cd / touch.bash_profile open.bash_profile export ANDROID_HOME=$HOME/.../sdk/ PATH=$PATH:$HOME/.../build-tools PATH=$PATH:$HOME/.../platform-tools PATH=$PATH:$HOME/.../tools Note: PATH variable is very crucial, must mention "$PATH:" before the value or else it will lead to the loss of other PATH values stored in it. 2. Creating AVD. AVD Manager can be launched through Eclipse. Open Eclipse Window -> Android Virtual Device Manager "Android Virtual Device (AVD) Manager" window will open. Click Create button. "Create new Android Virtual Device (AVD)" window will open. Select appropriate options and click OK. Now the new device will appear on Android Virtual Device Manager. Select the AVD and click Start. In "Launch options" window click Launch. 3. Launching Appium. Open Appium Select Android. In Android options, select the necessary fields. App Path - Path of the app (.apk file) Launch AVD - Select the emulator (Check if running on Emulator)

Automation name - Appium (API Level 17 or higher), Selendroid (API level 16 and below). In Appium options, select Server Address (default- 127.0.0.1) and port (default - 4723). Click Launch button. 4. Coding Open Eclipse This below code will launch the AVD through Appium. java-client jar contains the AppiumDriver class. DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setcapability("devicename", "Android"); capabilities.setcapability("platformname", "Android"); driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/ hub"),capabilities); Real Device (Android) 1. Connect the device via USB and set the mobile to "Developer mode" Android version 4.4 or higher: Settings -> About phone -> Version Infos -> Tap build info for 7 times. Android version below 4.3 : Settings -> Developer options -> USB Debugging 2. Step up ANROID_HOME and PATH variables in.bash_profile as follows : 3. Launching Appium. Uncheck the Launch AVD, if checked. Check Device Name and provide the name of device you connected. Get the device name by using below command in Terminal adb devices Select Automation name, Server address and click Launch. 4. Code for Emulator will work for Real device also, no need to modify anything. Simulator 1. Unlike AVD, simulators cannot be created. Simulator should be downloaded by the help of Xcode.

Open Xcode -> Preferences -> Download To launch simulator, Open Xcode -> Open Developer Tools -> ios Simulator Simulator will be launched, to change the devices select Open Simulator -> Hardware -> Device To change the display size of simulator select Open Simulator -> Window -> Scale 2. Launching Appium Open Appium Select ios. In ios options, select the necessary fields. App Path - Path of the app (.app file) Force device - Select the device (Check if running on Simulator) In Appium options, select Server Address (default- 127.0.0.1) and port (default - 4723). Click Launch button. 3. Coding Open Eclipse This below code will launch the Simulator through Appium. DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setcapability("devicename","iphone 5"); capabilities.setcapability("platformname", "ios"); driver = new IOSDriver(new URL("http://127.0.0.1:4723/wd/ hub"),capabilities); Real Device (ios) 1. Connect the device via USB. A valid ios Development distribution certificate is required for the device and the app should be signed. For more information on signings, certificates and profiles, please refer Apple documentation. 2. Install ideviceinstaller, below code will install it. brew install --HEAD ideviceinstaller

3. Launch Appium. Uncheck the Force Device, if checked. Check UDID and provide the name of device you connected. Once the device is connected, UDID can be seen in itunes and also in Organiser (Xcode -> Window -> Organiser) Select Server address and click Launch. 4. Coding Open Eclipse Below is the code for launching application in real device DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setcapability("devicename","ipad"); capabilities.setcapability("platformname", "ios"); driver = new IOSDriver (new URL("http://127.0.0.1:4723/wd/ hub"),capabilities); Inspecting Elements Inspection of elements are required in order to perform any action on those particular elements. Elements can be inspected through the "Inspector" available in Appium. Some other external tolls available exclusively for inspecting elements (e.g Spark Inspector), which can be downloaded from internet. Xcode also provides a inspector called "Accessibility Inspector" to inspect the elements which can be invoked my following below steps. Open Xcode -> Xcode -> Developer Tools -> Accessibility Inspector Note: If the inspectors are not showing the properties of elements, which means "Enable access for assistive devices and applications" option is disable. Enabling the option can be achieved by below steps. Mac (Apple icon) -> System Preferences -> Security & Privacy -> Privacy -> Accessibility -> Enable Launching and Killing Appium through code Launch Appium

Below java code will launch the Appium CommandLine command = new CommandLine("/Applications/Appium.app/ Contents/Resources/node/bin/node"); command.addargument("/applications/appium.app/contents/resources/ node_modules/appium/bin/appium.js", false); command.addargument("--address", false); command.addargument("127.0.0.1"); command.addargument("--port", false); command.addargument("4723"); command.addargument("--no-reset", false); DefaultExecuteResultHandler resulthandler = new DefaultExecuteResultHandler(); DefaultExecutor executor = new DefaultExecutor(); executor.setexitvalue(1); executor.execute(command, resulthandler); Kill Appium To kill the appium follow the below commands in Terminal lsof -i :4732 lsof - List of open files port - will be the port in which appium is launched Above command will provide the details of given port, in that PID number will be displayed. Use the PID number for the below command. Appium server will be terminated. kill -9 PID number Key Points & Solved Errors Key Points Application's element hierarchy cannot be seen through the inspectors if the developer built the application without enabling the Accessibility option App path given in code (i.e. in capabilities) will always override the app path present in Appium options When selecting CPU/ABI option while creating AVD, its always good to select ARM. Intel Atom chosen AVD takes long time to load or may not load at all in Mac OS X Selecting smaller screen size and lower API Level will make the AVD load faster Prior to java-client-2.0.0 jars, it enables to instantiate AppiumDriver, while in later versions of java-client AppiumDriver was changed into abstract

class. IOSDriver and AndroidDriver can be used with it Best option to connect a device is by selection it as a Media Device (MTP) Shortcut for Home button in Emulator and Simulator: fn + left arrow key (Android) and cmd + shift + H (ios) Solved Errors "Error: Command Failed: error: cannot bind to socket" - When the port is already in use, this error will happen. As mentioned earlier, using the "lsof" and "kill" commands we can make the respective ports free "Error: Unable to install" - when the application was not build using Development Distribution Certificate. This can be done by using Xcode, for that we need source (.xcodeproj) of the application "Error: Unable to install" - Even when the application is build using Development Distribution Certificate, this error will occur when ideviceinstaller is not installed "error: Could not find a device to launch" - platformname and devicename parameters mismatch Have to provide compatible version of operating system for respective devices "Instruments Trace Error : Failed to start trace. Instruments exited with code 253" - The application (.app) is not compiled for simulator or device may be locked and password protected "Timed out waiting for screenshot file" - Sporadic error which occur while capturing the screenshot. Handle this error by building a retry loop while capturing the screen, in next few attempts it will work. References http://appium.io/slate/en/tutorial/ios.html?java# https://github.com/appium/appium https://docs.saucelabs.com/tutorials/appium https://discuss.appium.io/