API & Mobile Testing (Android , IOS) For App

MiniTomar 5 views 15 slides Aug 13, 2024
Slide 1
Slide 1 of 15
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15

About This Presentation

API & Mobile Testing


Slide Content

virtusa
Agenda
1, Market Need and Why test mobile apps
| Mobile OS
Types of Mobile Apps
Ill. Mobile Testing tools and overall landscape
2. Mobile Automation
i} Android Configuration, Android SDK tools - Live Demo

ll Ul Automator Viewer & Appium Inspector- live Demo

lll, ABD = Android Debug bridge

3. Mobile Device Farm

Market need

- why test apps for smart devices

APP

Phrromprr”.

His cal forthe end
‘consumers of our
customers applications
o have a seamless
‘experience

62% of mobile users
stop using an app
coutight if hey find a
bug

App crasnes cause
71% of uninstals

virtusa

Value of App Testing for
State-of-art applications

Multiple versions of the
browsers and devices
cause compatibility issues

Faster releases and tum-
around time is required to
support shorter
product/service cycles

More than 50% of software
development effort is spent
on testing today

Mobile Operating Systems

‘To know different kinds of Mobile Applications we first need to understand what the
different Mobile platforms are (Operating System) available for which the mobile
application is being developed by the developers. Popular mobile platform available
are:

Android

los

Blackberry

Windows Mobile

Bada (Samsung Electronics)

Paim OS

‘Symbian

Android Is most popular Mobile OS because Its Open source and have huge
developer user base.

Mobile OS

Android!
72%

virtusa

Android
nos
motes

Types of Mobile Application

Native apps are specifically designed for a
particular operating system-i0S or
Android. They are codded in platform-
specific languages such as Swift or
Objective-C (for 105) or Java or Kotlin (for
Android). They are built using an operating
system's SDKs and have access to different
resources on a device: camera, GPS,
phone, device storage, etc.

+ Advantages: Good user experience &
performance, supports complex
functionality (including games) and
sophisticated animations, connects to
loT devices, good security

+ Disadvantages: high development &
maintenance costs, slow deployment,
requires more effort/skills to develop,
not supported on desktop, requires
users to update for the latest

ixes/features

Hybrid apps combine features of native
and web apps. They are written in HTMLS
and JavaScript, like web apps. For the most
part, they are web pages wrapped in a
mobile app using WebView. They are built
using cross-platform frameworks like
React, lonic, Sencha and Xamarin.

+ Advantages: Easier to develop than
native apps but provide similar
benefits, accessible on desktop and
mobile devices, good security, updates
automatically

* Disadvantages: high maintenance
costs, slow deployment

virtusa

Web mobile apps are websites optimized
for mobile browsers. Their functionality
resides entirely on a server. They are
written in JavaScript and HTMLS.

+ Advantages: cost-effective, easy to
develop, fast deployment, accessible
on desktop and mobile devices,
updates automatically

+ Disadvantages: security gaps, lacking
user experience/performance, not
available offline

Mobile Testing — Tools, Tech & Scope Landscape virtusa

MOBILE AUTOMATION J AUTOMATION EMERGING
DEVICES En ERARENCRE EANGUAGE

MOBILE“ GOOGLE ANDROID APPIUM JAVA LAMBDATEST
VIRTUAL+ APPLE 108 AUTOMATION XCUITEST cH DIGITAL Al om
BROWSERS SAMSUNG VOICE ‘SELENIUM RUBY SAUCE LABS GAMING
VIDEO EXPRESSO PYTHON BRONSER WEARABLES
TOCARZATION) | CYPRESS JAVASCRIPT PCLODY 10T
COMPATIBILITY WEBDRIVER 10 PERFECTO
INTERRUPT
USABILITY
NET
aRéaT MObIIS devices AVENABIE'IN thé tab; ** Also, Virtual devices are supported via Emulators

7 Copyright © 2019 Virtusa Corporation All Rights Reserved. +

virtusa

Mobile Automation Testing yp

Appium virtusa

| What is Appium? | is Appium?

Appium is an opensource mobile automation tool used for

Native-Android, Native-iOS, Mobile-WEB, and hybrid E
applications automation. It acts as a middleware server & a
which lets the automation framework hosted on desktop DE

OS to communicate with Mobile Application installed on
Mobile OS (Android, iOS).

a

Installation

Pre-requisite: Require Android SDK

+ You can get the latest version of Appium from

http://appium.io.
+ Follow the steps and install it.

Android Configuration
| Android SDK Setup | SDK Setup

+ To Run Applum for Android you will require android SDK.

+ You can download Android studio which comes along with android SDK as
bundle. User can download Android Studio from
htips:/developer.android.com/studiol.

| Android SDK Manager SDK Manager

‘To Run Appium for Android you will require Android SDK. To download and install
latest android APIs and development tools from the internet, android provide us
with android SDK manager. The SDK Manager provides you an interface that allows.
you to view, install, update, and uninstall packages for the Android SDK.

Android SDK manager comes with the Android SDK bundle.

| Android AVD Manager AVD Manager

AVD stands for Android Virtual Device. It is a configuration that defines the
characteristics of an Android phone, tablet, Wear OS, Android TV, or Automotive
OS device that we want to simulate in the Android Emulator. The AVD Manager
provides an interface that helps you to create and manage AVDs.

Corporation. Al Rights Reserved

virtusa

Android Device Configuration

Developer

USB debugging

virtusa

\droid Device Connectivi —

+ Before connecting the device to PC check following
things if they are enabled on your device
+ Developer options
+ Goto Settings - About Device
Locate Build number
+ Tap 7 times lo enable Developer options
- USB debugging
+ Ifthe Developer options is already
enabled, select it
+ Under debugging section, Enable the
check box for USB debugging

+ On PC when you connect the device using USB
cable, check if device is getting recognized.

+ On PC, navigate to "platform-tools” folder under
‘Android SDK installation folder. For example
D:\Androiatsdkiplatform-tools

+ Open command prompt in this folder and run
‘command: adb devices

+ Ifthe List of devices shows the connected device
as "unauthorized", disconnect the device and
reconnect it

+ Walt for few seconds and check if there is a
message “Allow USB debugging” on the device.

+ Click OK to allow the USB debugging

+ Re-run the command: adb devices. This time it
should show the authorized "device" under List of

devices

+

Android/iOS UI supported Locator Strategy virtusa

For any sort of Ul automation, we need to uniquely identify the Ul component of the screen. There are majorly two kind of
methodology/concept on which any automation works,

+ Object based tool

+ Image based tool
Appium automation works on Object based concept. For object-based automation we need address of the UI component on which
we can fire action scripts, like click, enter eto. These Ul component addresses is technically called as LOCATORS in automation
language. An Element Locator is nothing but an address that identifies a Ul Element on a Mobile App (or Website).

Appium provides few different ways to identify mobile elements. The popular locators strategies available is as below:

Resource-id: Ex - WebElement WEld=driver.findElementByld("com.android.settings:id/switch_text");
ClassName: Ex- WebElement WEClassName=driver findElementB yClassName ("android. widget. TextView
Name: Ex - WebElement WEName=driver findElementByName("Name”):
Content-desc: Ex - WebElement WEAccessiblityld=driver findElementsByAccessibiltyld ("Name");
Xpath: Ex - When none of the locator strategy works uniquely then xpath is savior.

WebElement WEXpath=driver.findElementsByXpath("//android widget Button[@content-desc=’ multiply’);

Image - recently introduced

Mobile lab — General Use Cases

A Use Cass | Use Case

i

1

1

1

1

1

1

1

1

|

Functional - Automation testing on 1
different form factors | Non-Funetional —

| App performance in various network
| condition - Mobile Network, Wi-Fi etc.
1» Interrupts related testing
|. Sim related use cases - calls, SMS
1
I
1
1
I
1
1
1
I
1

+ Android Browser scenario |

+ Android Native App

+ Android Hybrid App — Develop using i
Xamarin, PhoneGap etc.

+ iOS Browser scenario

1S Native App H

+ OS Hybrid App - Develop using Xamarin,
PhoneGap etc.

+ Wearables — Smart Watch, Fitbit

+ Automation testing for Parallel execution |
of multiple devices

Mare ue mn ours |

Use Case

7 mu

ruse cases

Audio related use cases using Text to
speech and Speech to text, For Example
18M Watson

Use Cases related Bluetooth and Wi
scenarios

Robotic Arm Integration - Scenarios
such as where human interaction is the
ony option

Medical and OT devices use cases
‘which will communicate via BT to a
device or Mobile App for data gathering

A glimpse of the lab virtusa

Physical Lab View Remote Lab View

= ñ
‘om

i=
|

a
y

Android/iOS Element Inspector Tools

UI Automator Viewer

‘The ulautomatorviewer tool provides a convenient GUI to scan and analyze
the Ul components currently displayed on an Android device. You can use
this tool to inspect the layout hierarchy and view the properties of UI
components that are visible on the foreground of the device. This
information lets you create more fine-grained tests using UI Automator, for
example by creating a UI selector that matches a specific visible property.

‘The ulautomatorviewer too! Is located In the <androld-sdk>/tools/bin
directory.

| Appium inspector Y

‘This comes with the Applum desktop client. You can use this for both
Android and iOS app.

virtusa

leerse

Android Debug Bridge virtusa

ADB (Andro

‘Android Debug Bridge (adb)
includes three components:
‘© Client, - Itis responsible to sends commands. The client runs on the test or development machine. We can invoke a
client from a command-line terminal by issuing an adb command.
Daemon - It runs commands on a device. The daemon runs as a background process on each device,
‘Server - It manages communication between the client and the daemon.

‘a command-line tool that lets you communicate with a device. It isa client-server program that

adb is included in the Android SDK Platform-Tools package which installs it at android, sdk/platform-tools/.

Operations we can perform using adb commands:

Know thelist of connected devices and its unique serial number
Installation and uninstallation

Copy files to/from a device

Take screenshop

Know App package and App Activity of the running app

Make a call

Send sms

Getting log files

Device Farm Architecture

Test Execution Machine

Dev Environment

Visual i
od Sid S eclipse

E, E
Page Class

y la

=P" co m

virtusa
Tags