How to set UP an Appium automated framework to test mobile apps

Slides:



Advertisements
Similar presentations
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Ashish Mishra Automation Lifecycle of Mobile Applications.
Advertisements

Programming with Android: SDK install and initial setup Luca Bedogni Marco Di Felice Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna.
Real World Development using OpenEdge Mobile – some advanced features Brian C. Preece Ypsilon Software Ltd
1 Mobile Computing Mobile First (formerly Worklight) Copyright 2015 by Janson Industries.
Google Android as a mobile development platform T Internet Technologies for Mobile Computing Olli Mäkinen.
2. Setting Up Your Android Development Environment.
ANDROID PROGRAMMING MODULE 1 – GETTING STARTED
UFCFX5-15-3Mobile Device Development Android Development Environments and Windows.
Setting up the Development Environment Copyright © SUPINFO. All rights reserved Preparation.
How to make it work? Doncho Minkov Telerik Academy academy.telerik.com Technical Trainer
SET UP COMPUTER ** PLEASE BE AWARE SCREENSHOTS MAY NOT MATCH **
Getting Started with Android Programming Note: if you have already installed android development tools, please check that you have the same version as.
By Ms.A.C.Sumathi AP(SG)/ Dept of CSE SNS College of Engineering, CBE.
Amazon EC2 Quick Start adapted from EC2_GetStarted.html.
Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel.
Mobile Programming Lecture 1 Getting Started. Today's Agenda About the Eclipse IDE Hello, World! Project Android Project Structure Intro to Activities,
Telerik Software Academy Software Quality Assurance.
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Adobe Presentation Brijesh Patel | Working with AIR Native Extensions.
1 Mobile Computing Set Up Copyright 2015 by Janson Industries.
Introduction to Android. Android as a system, is a java based operating system that runs on the Linux kernel. The system is very lightweight and full.
ANDROID Presented By Mastan Vali.SK. © artesis 2008 | 2 1. Introduction 2. Platform 3. Software development 4. Advantages Main topics.
Android for Java Developers Denver Java Users Group Jan 11, Mike
1 Thomas Lippert Senior Product Manager - Mobile What’s new in SMC 5.0.
Presented By: Muhammad Tariq Software Engineer Android Training course.
Web Automation Testing With Selenium By Rajesh Kanade.
Liferay Installation Prepared by: Do Xuan Hai 8 August 2011.
Selenium January Selenium course content  Introduction (Session-1)Session-  Automation  What is automation testing  When to go for automation.
Mohit Anand, Software Engineer Adobe 1 Selecting GUI Automation Testing Tool for Mobile Domain.
ANDROID APPLICATION DEVELOPMENT. ANDROID DEVELOPMENT DEVELOPER.ANDROID.COM/INDEX.HTML THE OFFICIAL SITE FOR ANDROID DEVELOPERS. PROVIDES THE ANDROID SDK.
© 2012 LogiGear Corporation. All Rights Reserved FitNesseFitNesse Authors: Nghia Pham 1.
Appium with Android Configuration.  Download Appium server:  Choose the latest version of appium.
Selenium server By, Kartikeya Rastogi Mayur Sapre Mosheca. R
Test Automation Using Selenium Presented by: Shambo Ghosh Ankit Sachan Samapti Sinhamahapatra Akshay Kotawala.
Intoduction to Andriod studio Environment With a hello world program.
Active-HDL Server Farm Course 11. All materials updated on: September 30, 2004 Outline 1.Introduction 2.Advantages 3.Requirements 4.Installation 5.Architecture.
APP DESIGN AND DEVELOPMENT WITH THE IONIC FRAMEWORK Chuck Leone
SAFARI TEST AUTOMATION: NAVIGATING THROUGH THE JUNGLE BY KARAN KUMAR AND JAMES CHUONG.
Guide To Develop Mobile Apps With Titanium. Agenda Overview Installation of Platform SDKs Pros of Appcelerator Titanium Cons of Appcelerator Titanium.
Day 1 Session 2. Setup & Installation
Introduction to Android Programming
TIZEN STUDIO INSTALLATION & ENVIRONMENT SETUP FOR DEVLAB
Mobile Device Development
Appium Studio Appium testing made easy at any scale.
Android Mobile Application Development
Development Environment
Mobile Testing – Survival Knowledge – Part V
JRA2: Acceptance Testing senarious
What is Apertis? Apertis is a versatile open source infrastructure tailored to the automotive needs and fit for a wide variety of electronic devices.
Obtaining the Required Tools
Android Studio, Android System Basics and Git
Android.
Apache Cordova Overview
Android development with RAD Studio
On the road: Test automation in practice for a BMW map update service
Creating a Windows 10 Virtual machine
Cross platform automated appium testing - A Primer
Appium Studio for Eclipse
Module 3 Building a web app.
SeeTestCloud Onsite.
Quality assurance platform for mobile apps, available as hosted SaaS or onsite deployment
Automation for mobile apps Presenter: Nikita Mader
Compile, Build, and Debug
Compile, Build, and Debug
Cordova & Cordova Plugin Installation and Management
How to Improve Releasing Efficiency via i18N/L10n Test Automation.
Software Setup & Validation
The Most Popular Android UI Automation Testing Tool Andrii Voitenko
Android Application Development
Open Automation Software
MOBILE PROGRAMMING Meriska Defriani, S.Komp, M.Kom Introduction
Presentation transcript:

How to set UP an Appium automated framework to test mobile apps Presented by Jorge Asensio © All rights reserved

Index PART 1: WHAT IS TESTING APPS LIKE? PART 2: APPIUM FEATURES PART 3: SETTING UP AN ANDROID FRAMEWORK PART 4: SETTING UP AN IOS FRAMEWORK PART 5: TESTING THE ANDROID APPS PART 6: TESTING THE IOS APPS PART 7: OBSTACLES AND LESSONS LEARNED © All rights reserved

Part 1: What is testing apps like? HOW TO MAKE SURE AN APP IS PROPERLY TESTED © All rights reserved

What is in an app? An app by any other name would be as difficult to test Functional Testing Lab Testing Performance Testing Load Testing Interrupt Testing Usability Testing Installation Testing © All rights reserved

What is in an app? An app by any other name would be as difficult to test Certification Testing Security Testing Localisation Testing Geolocation Testing Outdated software Testing Memory Leakage Testing © All rights reserved

Adapting test types to the mobile app industry Turbulent market Agile / DevOps approaches Time to market Constant competition Google / Apple restrictions Need for stable automated CI / CD set-ups © All rights reserved

Adapting test types to the mobile app industry Key test types Installation Testing Interrupt Testing (networks, transactions) Usability Testing (response from users) Security Testing (especially Android) Load Testing Crowdsourced Testing / Outsourced Testing © All rights reserved

Part 2: APPIUM FEATURES A FRAMEWORK DESIGNED TO TEST MOBILE APPS © All rights reserved

Test automation from a user perspective Appium is meant to test apps according to: Level: Acceptance Testing Requirement Type: Functional AUT: Native, Web, Hybrid © All rights reserved

Appium in a nutshell Appium drives Android and iOS Applications © All rights reserved

A Selenium framework for Mobile testing Open-source, freely distributed Drives native, hybrid and web apps Supports physical and virtual devices No dependency on device OS Multiple language support Multiple integrations with tools and frameworks © All rights reserved

Open-source Appium is free and open source Appium server and code bindings: www.appium.io Different possibilities for framework set-up © All rights reserved

Multiple types of app under test Types of app supported: Native Web Hybrid © All rights reserved

Supports physical and virtual devices © All rights reserved

Cross-platform © All rights reserved

Multiple language support © All rights reserved

Multiple integrations with tools and frameworks © All rights reserved

Continuous Integration / Continuous Deployment Can trigger tests from the major CI / CD servers © All rights reserved

Part 3: SETTING UP AN IOS FRAMEWORK iOS + Appium © All rights reserved

Previous knowledge required Java Mac OS X Terminal / Windows Command X-Code Selenium © All rights reserved

The Appium approach proposed Testcase.java Testng.xml © All rights reserved

3.1.1 Installing Appium and dependencies First install Node.js Installer \ Binaries (Win, MacOS, Linux): https://nodejs.org Homebrew (MacOS, Linux) Install Carthage © All rights reserved

3.1.2 Installing Appium and dependencies Set JAVA_HOME in .bash profile Locate JDK Edit bash_profile Input 2 export lines Save and restart Terminal Install authorize-ios Install ios-deploy © All rights reserved

3.1.3 Installing Appium and dependencies Install ideviceinstaller Install ios_webkit_debug_proxy Install Appium (follow by @version for a specific version) Install and test Appium Doctor © All rights reserved

3.1.4 Installing Appium and dependencies Branch the device in a USB port and test connection (UDID): © All rights reserved

3.1.5 Installing Appium and dependencies Install Maven and check version Add the Maven path line to .bash_profile © All rights reserved

3.1.6 Installing Appium and dependencies Install Maven and check version Add the Maven path line to .bash_profile © All rights reserved

3.2.1 Apple Developer Account Settings Get the Team ID Register the device under test © All rights reserved

3.2.2 Apple Developer Account Settings Get the Team ID Register the device under test © All rights reserved

3.3.1 Installing and configuring X-Code Install X-Code. This is needed to build the AUT Access the AppStore and download/install X-Code https://developer.apple.com/xcode/ © All rights reserved

3.3.2 Installing and configuring X-Code Download the X-Code project WebDriverAgent from https://github.com/facebookarchive/WebDriverAgent WenDriverAgent is a WebDriver server to remote control iOS devices © All rights reserved

3.3.3 Installing and configuring X-Code Run the WebDriverAgent Project on X-Code Configure the parameters: Product Name Team: matches the team stated on the Apple Developer account Organisation Name Organisation Identifier: follows the pattern com.string Bundle identifier: follows the pattern com.string.WebDriverAgentRunner © All rights reserved

3.3.4 Installing and configuring X-Code On General / Signing, the Team of the Apple Developer ID must be identified and selected. With this Team ID a Provisioning Profile will be provided and signed com.ucaat.WebDriverAgentRunner © All rights reserved

3.3.5 Installing and configuring X-Code Next to the layout options, display the menu to select devices and simulators Select the branched device to build the AUT © All rights reserved

3.4 Setting up the device Select Settings on your iOS device and select Developer Switch Enable UI Automation on © All rights reserved

3.5 Setting IDE and plug-ins up Download and install Eclipse https://www.eclipse.org/downloads/packages/ Install TestNG plug-in: launch Eclipse, hit Help > Install New Software, paste http://beust.com/eclipse into Work with and hit Enter. © All rights reserved

3.6 Code dependencies Open a new Maven project on Eclipse Open the POM.xml file and add dependencies © All rights reserved

3.7.1 Writing the test class Create a class (e.g. AppTest) Import the necessary libraries Appium Classes to drive iOS: IOSDriver, IOSElement © All rights reserved

3.7.2 Writing the test class a) Functions to run before the execution of the test suite b) Set localhost URL c) Set up capabilities d) Initialise driver with URL and capabilities. Like Selenium © All rights reserved

3.7.3 Writing the test class Regarding the basic capabilities: Device Name Device UDID Platform App Automation: XCUITest xcodeOrgId: Apple Team ID Bundle ID © All rights reserved

3.7.4 Writing the test class Automation: XCUITest Only 2 automation engines for iOS: XCUITest (preferred) YouiEngine © All rights reserved

3.7.5 Writing the test class Capabilities for a real device: Team ID X-Code Signing ID © All rights reserved

3.7.6 Writing the test class Capabilities for a real device (2): UDID iTunes Terminal © All rights reserved

3.7.7 Writing the test class Capabilities for a real device (2): APP: IPA file Device name © All rights reserved

3.7.8 Writing the test class Capabilities for a real device (3): Bundle ID © All rights reserved

3.7.9 Writing the test class e) Functions that will be run after every test suite f) Test Case methods © All rights reserved

3.7.10 Writing the test class: checking elements Inspecting elements: Appium element inspector: Enter device model Enter OS version There are others from different developers © All rights reserved

3.8.1 Running the appium server Can be done by simply entering this on Terminal (default port 4723): Alternative 1: Appium Desktop Download and install the Appium Desktop application: https://github.com/appium/appium-desktop/releases © All rights reserved

3.8.2 Running the appium server Alternative 2: programmatically Implementing AppiumDriverLocalService: 1 2 3 4 AppiumDriverLocalService service = AppiumDriverLocalService.buildDefaultService(); service.start(); // the tests to be executed, like the test file example stated on // the slides earlier service.stop(); © All rights reserved

3.8.3 Running the appium server Alternative 2: programmatically Implementing AppiumServiceBuilder import org.openqa.selenium.remote.DesiredCapabilities; import io.appium.java_client.service.local.AppiumDriverLocalService; import io.appium.java_client.service.local.AppiumServiceBuilder; import io.appium.java_client.service.local.flags.GeneralServerFlag;   public class AppiumServerJava { private AppiumDriverLocalService service; private AppiumServiceBuilder builder; private DesiredCapabilities cap; public void startServer() { //Set Capabilities cap = new DesiredCapabilities(); cap.setCapability("noReset", "false"); //Build the Appium service builder = new AppiumServiceBuilder(); builder.withIPAddress("127.0.0.1"); builder.usingPort(4723); builder.withCapabilities(cap); builder.withArgument(GeneralServerFlag.SESSION_OVERRIDE); builder.withArgument(GeneralServerFlag.LOG_LEVEL,"error"); //Start the server with the builder service = AppiumDriverLocalService.buildService(builder); service.start(); } © All rights reserved

3.8.4 Running the appium server Alternative 2: programmatically Implementing AppiumServiceBuilder (2) public void stopServer() { service.stop(); }   public boolean checkIfServerIsRunnning(int port) { boolean isServerRunning = false; ServerSocket serverSocket; try { serverSocket = new ServerSocket(port); serverSocket.close(); } catch (IOException e) { //If control comes here, then it means that the port is in use isServerRunning = true; } finally { serverSocket = null; return isServerRunning; © All rights reserved

3.8.5 Running the appium server Alternative 2: programmatically Implementing AppiumServiceBuilder (3) public static void main(String[] args) { AppiumServerJava appiumServer = new AppiumServerJava(); int port = 4723; if(!appiumServer.checkIfServerIsRunnning(port)) { appiumServer.startServer(); appiumServer.stopServer(); } else { System.out.println("Appium Server already running on Port - " + port); } © All rights reserved

3.9 Checking device status iOS webkit debug proxy: one instance per device UDID_DEVICE: device identifier FREE_PORT: an unused port idevice_id ios_webkit_debug_proxy -c UDID_DEVICE:FREE_PORT © All rights reserved

3.10 Ready up the Testng.xml file Test name: name of the suite that will show on reports Parameters: parametrise values that change from one device \ test environment from another. Class: test class that must be executed to trigger test cases © All rights reserved

3.11.1 Run a TestNG test case with Appium Right-click on the testng.xml file / Run As / TestNG Suite © All rights reserved

3.11.2 Run a TestNG test case with Appium Reports: multiple types. Configurable with Appium-Java libraries XML, HTML, JSON © All rights reserved

Minimum Requirements summary Apple Developer ID Mac with XCode Eclipse with TestNG Appium libraries and dependencies Java Maven Test class © All rights reserved

Part 4: SETTING UP AN ANDROID FRAMEWORK Android + Appium © All rights reserved

4.1.1 Install Appium Dependencies Node.js and NPM remain necessary Java remains necessary Install Android SDK, Command line tools only: https://developer.android.com/studio © All rights reserved

4.1.2 Install Appium Dependencies Check the location of the following essential folders: platform-tools tools Update paths on bash_profile, by adding the following: Then save and quit © All rights reserved

4.2 Android SDK Manager Access the Android directory Run Android SDK Manager Select the SDK Platform to match Android versions Hit Install packages… © All rights reserved

4.3.1 Configuring the Android device Branch the phone into a USB port. Select Settings / About phone Tap 7 times in quick succession on Build number. The toast message You are now a developer! will pop up © All rights reserved

4.3.2 Configuring the Android device Fall back to Settings and locate Develop Options Check the option USB debugging. © All rights reserved

4.3.3 Configuring the Android device Hit OK on confirmation message. Confirm the computer returns the RSA key © All rights reserved

4.4 Checking Android connectivity Open the terminal Run the Android Device Bridge (ADB) command (same for Windows command): The device ID will show: © All rights reserved

4.5.1 Android plug-in on Eclipse Open Eclipse and hit Help / Install New Software Add the following http://dl-ssl.google.com/android/eclipse/ on Work with and hit OK Check Developer Tools / Next / Finish © All rights reserved

4.5.2 Android plug-in on Eclipse Hit Window / Preferences / Android Make sure the path to SDK is correct, then hit Apply / OK © All rights reserved

4.6.1 Checking elements Run Appium desktop application Hit the Android button Hit the settings menu and fill up with the information; same way as iOS. © All rights reserved

4.6.2 Checking elements Run uiautomatorviewer on Terminal or Windows Command Get a screenshot and identify elements Not all elements visible © All rights reserved

4.7 Different capabilities Running the Appium server remains the same Capabilities are different Classes to drive Android: AndroidDriver, MobileElement Native app vs hybrid app: Many automation engines: UIAutomator, Espresso, Selendroid. © All rights reserved

Part 5: TESTING THE APPS ESSENTIAL OPERATIONS WITH APPIUM © All rights reserved

Common basic operations: the Selenium way Declaring a driver with capabilities Finding an element Waiting for an element Operations with elements driver = new IOSDriver<IOSElement>(“http://127.0.0.1:4723”, capabilities) driver2 = new AndroidDriver<AndroidElement>(“http://127.0.0.1:4723”, capabilities) IOSElement e = driver.findElement(By.Xpath(“//div[@class=‘ucaatrocks’]”)) AndroidElement e = driver.findElement(By.Xpath(“//div[@class=‘ucaatrocks’]”)) import org.openqa.selenium.support.ui.WebDriverWait; WebDriverWait webDriverWait; webDriverWait.until(ExpectedConditions.visibilityOfElementLocated(elementBy)); e.click(), e.sendKeys(), e.getText(), e.navigate(), e.close(), e.quit()… © All rights reserved

Part 6: OBSTACLES AND EXPERIENCES: iOS What has to be taken into account setting up Appium and iOS © All rights reserved

Restrictions with Apple Tricky set-up Need an Apple machine Need an Apple Dev account X-Code deployment © All rights reserved

Tricky set-up Many dependencies Alignment of versions of the parts involved: obsolescence of software and hardware © All rights reserved

Tricky set-up Maintenance of framework Complex parallel execution Derived from the dependencies and integrable components Complex parallel execution Individual proxy set-up Lately idb has improved for device and simulator parallel testing: https://github.com/facebook/idb © All rights reserved

X-Code deployment Necessary to build the app under test WebDriver Agent crashes often © All rights reserved

Need an Apple machine Necessary to install the app under test in the device Appium relies on native OS X libraries to support iOS testing Costly © All rights reserved

Need an Apple Developer account Need to sign in on X-Code prior to test-building Requires a paid subscription © All rights reserved

Part 7: OBSTACLES AND EXPERIENCES: Android What has to be taken into account setting up Appium and Android © All rights reserved

Appium Android Specific SDK for each Android version Very heavy SDK files Differences and conflicts linked to automation engines Different Android implementations (device brands) require additional coding © All rights reserved

Part 7: CHALLENGES What is on the horizon? © All rights reserved

What could be improved? Increase the simplicity for automation: iOS set up Automation engines on Android Allow automation under no Apple Developer policy? More facilities to test with certain CI servers (Jenkins) Improved smart device proxy selection © All rights reserved

BIBLIOGRAPHY Sauce Labs www.saucelabs.com Today Software Magazine www.todaysoftmag.com Appium project http://appium.io Research Gate www.researchgate.net Software Testing Class www.softwaretestingclass.com Android www.android.com Apple www.apple.com © All rights reserved

Thank you for your attention! Any questions? © All rights reserved