Powerful Google developer tools for immediate impact! (2023-24 C)
Everything You Need To Know about Appium and Selenium
1. Perfecto Mobile CQ Lab
Selenium & Appium
Intro and Demo for
Partners
David Broerman
Partner Enablement Manager
Phone: 727. 225.2826 / Email:
davidb@perfectomobile.com
2. Agenda
• Intro to Perfecto
• Understanding the CQ Lab - Basic
Architecture/Setup
• Automation Testing
• High Level Overview of Selenium/Appium & how Perfecto fits in
• Mobile Application Types
• Object Trees
• Demo
• Selenium RemoteWebDriver/Appium
• Basic prerequisites
• Project Creation, Script Creation/Review and Execution (Java/Eclipse)
• Review Execution Report
3. Intro to Perfecto
Dominant leader &
visionary
Strong
Ecosystem
Perfecto @ a glance
Partnering with Enterprises and their System Integration Partners to
deliver exceptional digital experiences.
“Perfecto Mobile marks shift in mobile
apps QA with Continuous Quality Lab”
3
Setting the bar for
market success
• Founded in late 2006, Business HQ in Boston
• Over 300 employees globally
• Fortune 500 customer base
8/29/2016
Cloud Based Continuous Quality Lab enabling testing and monitoring of all
digital platforms on real devices and real end user conditions,
for enterprises adopting agile delivery processes.
Perfecto Offers
4. Dev
Environments
Cloud Based Quality Platform For The Digital Era
Any IDE
Any test
framework
Any CI server
Any test tool
User Condition Testing Layer
Functional
Testing
Performance
Testing
Quality in
Production
Customer
Support
One Lab for all Digital Platforms
Code Test Production Support
Continuous Quality Reporting
7. Automation Testing
• Selenium RemoteWebDriver
• Open Source Automation Framework for automating browser testing
• Perfecto Mobile extends Selenium to support mobile device browsers and
apps
• Multi-language and IDE support
• Appium
• “Aims to automate any mobile app from any language and any test
framework”
• Open Source - Extends Selenium for native (also hybrid applications)
• Supports iOS and Android
• Multi-language and IDE support
• Perfecto
• Testing on real devices in the cloud
• Real End User Conditions
• Perfecto Mobile proprietary functionalities (not available in Selenium/Appium)
• GPS Location, Device Vitals, Network Virtualization
8. Why was Selenium named
Selenium?
• Selenium was originally created as an alternative to Mercury
Interactive’s QuickTest Professional (now known as UFT)
• The remedy for Mercury poisoning is Selenium!
9. Mobile Application Types
Standard testing tool sets
Use Selenium RWD for web applications
Use Appium for native appsUse Selenium RWD for hybrid apps
(can also use Appium)
10. Perfecto Mobile – Enterprise Grade
Complete
SDLC (Manual,
Automation,
APM)
Customer
Support
(24x7), NOC,
SLA’s
CQL,
Continuously
up to date
Enterprise
Security, SSO,
Governance,
Private Clouds
Perfecto Mobile – Environmental Capabilities
Network
Virtualization/
Profiles
Large scale lab
DaaS
Hybrid Cloud
solution
Single user
performance
Device and App
Vitals
GPS Injection
Device logs
Global device
coverage, real
carriers
Perfecto Mobile - Automation
Both visual &
Native objects
Testing connects to
a CQL – Always On
Rich Media reports
Parallel Execution
CI Ready
Unattended Test
Perfecto Mobile – Appium Test Framework
Coverage
Appium Test Framework
Local Devices Only –
Not a Test Lab
Native Objects Only,
No Visual Analysis
In App Testing,
No System Level – Breaks CI
Only Automation Solution (No
Manual, No APM)
Not enterprise grade Security
(local testing)
Community Driven
Limited Support
No end-user
environments
Very basic test reports
No support model
Customers manage
device issues
11. Website & Apps – Object Trees/Identifying Objects
• Web Objects
• DOM
• Same Tree (PM or Appium)
• Native App Objects
• PM or Appium framework
• Separate naming for
Android and iOS
• Hybrid Application
• PM automation framework
• Mix of Native and DOM
objects
DOM Perfecto
Mobile
Appium
13. Architecture
Mobile WebDriver/RWD
Java code
Running in Eclipse
HTTP
command
level API
MCM
(Mobile Cloud Manager –
Executes scripts as well as
storing within its
repository and reports)
HTTP
HSS
(Handset Server -
manages all device
connectivity)
MobileCloud Plugin Example
Real devices connected via USB cable
8/29/2016
13
16. We Make Open Source, Enterprise
Grade
Mobile Cloud Platform
Environment Capabilities
Automation
Selenium or Appium
IDEIDE
Enterprise
Grade
Lab
Zero test code changes
Selenium or Appium
18. Pre-requisites
• Eclipse Working environment
• MobileCloud for Eclipse plugin (download provided as
part of package by Perfecto)
• This plug-in that lets users work with devices, record operations and
run their test in a convenient way all from within Eclipse.
• All Eclipse capabilities, such as code re-factoring and step-by-step
debugging, can be used.
• The java code can run as a standalone Java application and can be
executed from different testing frameworks such as TestNG or JUnit.
Before getting started with the technical implementation of our solution, let’s begin with an introduction to the types of mobile applications, and automation testing using Selenium RWD and Appium.
Next we will take a look at the Perfecto Mobile RWD extension to mobile devices (for web and hybrid applications) and Appium implementation (for native applications).
Slide objective – Perfecto is committed to helping enterprises leverage existing practices, assets and expertise
Perfecto Mobile strives integrate with popular tools used by enterprises. Customers can leverage existing assets and expertise . Our support for various tools is constantly expanding. Some customers also take advantage of our published API to create custom extensions to different frameworks.
Paypal’s integrated the open source Project Nemo, selenium-webdriver automation for node.js, using the API to provide its DevTest teams a tailor fit Java Script environment.
How does it work?
focus on two testing environments, supported by Perfecto Mobile: Selenium RemoteWebDriver and Appium.
Selenium RemoteWebDriver
Selenium is an open-source tool used for automating browser testing.
(For more advanced users, familiar with WebDriver: RemoteWebDriver is an implementation class of the WebDriver interface that a test script developer can use to execute their test scripts via the RemoteWebDriver server on a remote machine.)
Perfecto Mobile has extended RemoteWebDriver to support mobile web and hybrid applications (in the Perfecto Mobile Continuous Quality Lab – CQ Lab).
Language support includes Java, Ruby, Python, C#...
Appium
Appium is an open-source automation testing framework that is based on the Selenium WebDriver; that’s extended with new classes to support mobile application testing. It contains specific classes for iOS and Android application testing.
Perfecto Mobile supports the complete suite of Appium tools, in the CQ Lab, making it an Enterprise Grade Quality Solution. Also, Perfecto Mobile has extended the support to include proprietary Perfecto Mobile functionalities (that are not available in Selenium).
Selenium is an open source test engine that supports testing web based applications on desktop and mobile device browsers
As we have already established, there are three types of mobile applications – Web (regular/mobile browsers), Hybrid and Native.
The standard Selenium RemoteWebDriver allows us to test desktop browsers; and Perfecto Mobile has extended this to include browsers running on mobile devices.
Perfecto Mobile recommends using:
Selenium RemoteWebDriver for testing web applications (regular and mobile browsers)
Appium for native applications, and
Selenium RemoteWebDriver for hybrid applications
Identifying objects on the different types of mobile applications can be done in many ways. In this course we will focus on using the following frameworks, according to Perfecto Mobile best practices:
the DOM objects for testing web applications
Appium framework for testing Native applications, and
the Perfecto Mobile framework for testing hybrid applications
This enables us to find, view properties, and perform interactions on the application using objects (such as a clicking on something on the device screen, selecting an image or text element, and setting text to an edit field).
(For beginner users, a little more about identifying objects:
Application User Interfaces are drawn to the screen based on a definition (that’s provided by the application) of how and where to draw the different UI Elements. The definition is a hierarchy of available UI Elements that can be described as an Object Tree.
The Object Tree for Web applications uses a standard set of UI Element types to describe how to draw the User Interface. This is the DOM tree and the UI Elements in the standard can be used to describe any website or web application.)
The Perfecto Mobile and Appium Frameworks:
In the world of mobile applications, it is not as simple. Apple has its own proprietary set of UI Elements and this is different from the proprietary set used by Android. Perfecto Mobile created a framework that allows us to translate the competing UI Elements of the different application UI sets into a “canonical” set of UI Elements and describe the UI structure of an application using these generic UI Elements. This is the Perfecto Mobile framework Object Tree.
Appium, that we will be using in the latter part of the course to test native apps, references the UI Elements using the names provided by the proprietary description files. This is the Appium framework Object Tree.
The Perfecto Mobile framework identifies the objects in the application with the same standard. This means that the object tree representation of the elements will be the same on both iOS and Android applications.
The Appium framework uses two different object tree representations – UI Automator for Android and UI Automation for iOS. This means that when we develop our automation test, according to this mode of work, we will need to create two separate tests (one for Android and another for iOS).
(For advanced users, the Perfecto Mobile framework supports identification of the objects either with the application classes or based on a translated generic set of classes. This enables using the same objects for both Android and iOS applications, also referred to as ScriptOnce. This will be covered in later modules.)
The framework we choose to work with will determine the object tree representation, in XML format, that we see and work with when using the Perfecto Mobile Object Spy.
(For beginner users, each object is refined by a set of attributes that define what is actually displayed. For example, the text attribute defines the text to display.)
How does it work?
How does it work?
Before we move forward on the MobileCloud Plugin and other details of the WebDriver, let’s take a quick look at the architecture that defines this solution.
First, notice that we have a real device that is connected, via a USB cable, to the Perfecto Handset Server or HSS). Through this USB cable we get a live streaming from the device and are able to control the device; including any device real user commands/gestures (such as tap, swipe, click etc.).
The HSS, which is responsible for managing all device connectivity, gets its commands from the MobileCloud manager (MCM) server. The MCM is the component responsible for executing all of the scripts as well as storing within its repository and reports. The MCM gets its commands via the HTTP command level API, which are locally generated by the MobileCloud WebDriver.
Remember, Perfecto Mobile helps you implement continuous quality through our continuous quality lab as a service – embedding quality into every step of the lifecycle including unattended automation on real devices through our always on secure cloud offering that we manage.
*Represents a classic deployment type. Other deployment types may be slightly different.
Before we create our driver instance, we need to define the DesiredCapabilities.
(For beginner users, DesiredCapabilities is the java class that defines the list of information items needed to initialize the driver. Perfecto expanded the types of items in the list to include authentication information to connect to the CQ Lab and identify the device to use.)
The DesiredCapabilities can be separated into three categories:
CQ Lab capabilities: Perfecto Lab, username, and password, automationframework
The default automation framework is Appium and can be used in native and web applications. In Hybrid applications the perfecto mobile framework must be selected/
Device capabilities: device characteristicsDefine the capabilities to select a device in the Lab according to device attributes, instead of a specific device ID; and define the CQ Lab credentials.Important Note: use either the deviceName capability OR the platformName & platformVersion capabilities.(Note: A specific device can still be selected using the deviceName capability.)
Basic capabilities: selects the browser. Browser Name: chrome, mobileChrome, safari, mobileSafari, mobileOS, mobileDefault, perfectomobile(The Perfecto best practice is to use “mobileOS”, which will set the browser name as the default browser of the mobile OS. For example, mobileChrome for Android devices.)
The Basic capabilities can be confusing because they are a RWD construction extended by Perfecto. Let’s understand how it works:
1. The mobile device to work on is selected by the device capability
2. on the mobile device, we want to work with a specific browser, selecting mobileOS is recommended and it will select the default Chrome for Android, Safari for Apple and IE for WindowsPhone.
It is possible to define it with other values from the list.
For more details on defining capabilities, go to https://community.perfectomobile.com/series/20208/posts/945255
To dive further into Perfecto’s approach with open source, let’s look at our Selenium and Appium implementation. Perfecto does more than simply hosting servers. Perfecto has extended capabilities of test Frameworks with key capabilities uniquely relevant to mobile app quality at the scale required by enterprises.
Enterprise ready open source test frameworks require the ability to control mimicking the end user environment something not available in the currently available open source implementation. Additionally, important automation capabilities are also added. For example, teams utilizing other tools may be familiar performing object identification using either native properties or visual (OCR, Image) methods. Perfecto enables teams to use both for optimizing performance.
Beyond the technical enhancements, Perfecto meets the security and support requirements enterprises commonly require. For example, access controls for users and devices are centrally managed with strong audit logs.
Show next slide –create and execute demo project, review results
Before you begin, you will need to have Eclipse installed, and you can then download the MobileCloud for Eclipse plugin which is provided as part of a package by Perfecto Mobile. You can get more information on plug ins, code samples, training, frequently asked questions on our Community Page at https://community.perfectomobile.com/
The plugin includes:
Two project views and a project template
Note: the plugin should be updated regularly according to Perfecto Mobile version updates. This is done just like any other plugins (From within Eclipse, go to Help > Check for updates). You do not have to download and install this plug in, it’s not mandatory…Perfecto built this plug in to make things easier around object spy and analysis, using jar files, and the dashboard.
Notes: Let’s review a sample test.
Use Eclipse Project Named TrainingProjectExample
RemoteWebDriverTest.java – run as java test
Credentials in code: To run the sample remember to add your credentials and Lab URL
String host = “myLab.perfectomobile.com";
capabilities.setCapability("user", “myUser");
capabilities.setCapability("password", “MyPassword");
Selenium and Perfecto Tree
Uses BB&T U application – tried to login with username, password and validates error message for unsuccessful login
Also opens device browser, goes to perfecto sample page, logs in and validates successful login