Challenge 2

Challenges of automated mobile UI testing
Bartłomiej Pisulak
Software Engineer – Pegasystems
Trainer – Compendium CE
2
Agenda
What are we going
to talk about?
• Challenges
• Frameworks
• Demo
• Q&A
3
Why is it important?
4
App User Retention
5
Challenge 1
Defining scope
6
Challenge 2
Choosing the right technique
Manual
Structural
Visual
7
Challenge 3
Maintenance (UI is subject to evolution)
8
Challenge 4
Automation
9
Frameworks
10
Appium
“One framework to rule them all”
Appium is the cross-platform
solution for native and hybrid
mobile automation
11
Appium Architecture
HTTP server that creates and
handles WebDriver sessions
Starts a “test case” on the
device that spawns a server
and
listens
for
proxies
commands
12
Appium Philosophy
Test the same app
you submit to the
marketplace
Write your tests
in any language,
using any
framework
Use a standard
automation
specification and
API
Build a large and
thriving opensource community
effort
13
Appium on iOS
14
Connection initialization
desired_caps = {}
desired_caps['appium-version'] = '1.0’
desired_caps['platformName'] = 'iOS’
desired_caps['platformVersion'] = '8.1’
desired_caps['deviceName'] = 'iPhone 5s’
desired_caps['app'] = os.path.abspath(‘OSS2015.app')
self.driver = webdriver.Remote('http://0.0.0.0:4723/wd/hub',
desired_caps)
15
Connection initialization
desired_caps = {}
desired_caps['appium-version'] = '1.0’
desired_caps['platformName'] = 'Android’
desired_caps['platformVersion'] = '4.4’
desired_caps['deviceName'] = 'Nexus’
desired_caps['app'] = os.path.abspath(‘app-debug.apk')
self.driver = webdriver.Remote('http://0.0.0.0:4723/wd/hub',
desired_caps)
16
Code examples
Getting elements
btn = self.driver.find_element_by_name("SAY HELLO")
btn =
self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[1]/UIA
Button[1]")
Interactio
nbtn.click()
Combining with unit tests
self.assertEqual(btn.text, "SAY HELLO")
17
Demo: OSSa
18
Demo: Real-life Case
How to add automated UI tests to cross-platform development IDE
Python + Appium +
Imagemagick +
Jenkins
19
To sum up…
Ask yourself: do I need UI testing?
Realize your goals
Design carefully
Maintenance!!!
Automate
Don’t reinvent the wheel – spend your time
on doing creative things :)
20
Q&A