SlideShare a Scribd company logo
Unity Application Testing Automation
with Appium and Image Recognition
Maxim Mozgovoy
Evgeny Pyshkin
University of Aizu, Japan
Introducing Automated Smoke Testing
• Aimed at performing basic checkups:
• Program runs at all.
• Program is able to react to user input.
• Program is able to connect to perform certain basic functions.
• Can be a part of a continuous integration pipeline:
• Run automated smoke tests for each new build.
• (Already integrated into the Google Play Developer Console).
2
The Case of a Mobile Game
• Resource-intensive application,
may crash or run slowly.
• May behave very differently
on different devices.
• Contains no native GUI controls.
Contains elements that are easy
to overlook with manual testing.
• Stress tests may be beneficial
(such as running the app for 5 hours or with poor internet connection).
• Real mobile devices required (not emulators / simulators).
3
Problem 1: Engineering the Tests
How to design and run a GUI / smoke test on a mobile device?
De facto standard approach:
• Connect mobile devices to a “test server” running some special software.
• Execute testing scenarios on a remote machine via the server.
4
Client
(runs tests)
Server
(operates mobile devices)
Server Software
• Appium:
• Can be installed on Mac / Windows / Linux.
• Supports test scripts written in Java / JavaScript / Python / C# / etc.
• Can test Android, iOS and Windows applications.
• Calabash:
• Supports Android and iOS applications via different server versions.
• Supports Ruby tests scripts only.
• Note: these systems work because target platforms explicitly support
automation (via adb & UIAutomator on Android,
UIAutomation & XCUITest on iOS, etc.)
5
Test Scripts
• Logically, a test script is a sequence of statements like this:
wait 10 sec
tap location (100, 50)
assert that OK button appears
press OK button
• In native GUIs Appium can directly access individual controls:
6
e = appium.find_element_by_class_name('android.widget.EditText')
e.send_keys("hello")
ok = appium.find_element_by_class_name('android.widget.Button')
ok.click()
Testing Apps with Custom GUI (Unity-made Games)
7
similarity = 0.78
similarity = 0.96
Take screenshots with Appium and use OpenCV to recognize areas via
matchTemplate() function. Note: 100% similarity cannot
be achieved due to screen rendering differences.
In both cases tests are quite slow (inherent limitations)
Problem 2: Maintaining a Mobile Farm
• Ideally, each new build should be tested on a variety of mobile devices.
• Solution: use a cloud mobile farm provider! (AWS, Bitbar, etc.)
• Advantages: hassle-free setup, hundreds (!) of mobile devices.
• Drawbacks: still not all devices, high costs: 14-17 US¢ per minute per
device, while our tests take > 1hr on each device per build
(+ stress tests). So, e.g., 5 devices, 1hr ≈ 45 USD.
8
Client Server
New
build
Reports
9
Building Your Own Mobile Farm
+
Appium + test scripts
+
Test Runner
Software (in-house)
Test Runner
• Gets fresh builds from TeamCity (build machine)
• Runs all tests on all devices.
• Generates HTML reports with
game action logs and screenshots.
• Still under heavy development.
10
The Adventure Begins (and Never Ends…)
11
First, you might want to use
a small Windows or Linux server
It will work perfect with
any Android device
…but not with
iPhone or iPad
The Adventure Begins (and Never Ends…)
12
So you’ll have to ditch it
and use a Mac
The Adventure Begins (and Never Ends…)
13
Then you’ll realize that long tests
drain the battery and search for
powered USB hubs
…will find lots of them…
The Adventure Begins (and Never Ends…)
14
…and realize that “powered” means that they
simply have some dedicated charging ports
and get excited with their specs
The Adventure Begins (and Never Ends…)
15
…And finally find the hub that does the job
(not without quirks, but nobody’s perfect)
…then study its compatibility table:
The Adventure Begins (and Never Ends…)
16
Then realize that not all devices are created equal. For example:
On Nexus 7 sometimes you need to
make 2-3 attempts before an application
is installed, it is a norm to get an
INSTALL_FAILED_INVALID_URI error with
no reason.
The Adventure Begins (and Never Ends…)
17
Then realize that not all devices are created equal. For example:
On Xiaomi Redmi Note 3 Pro after a
number of install / uninstall cycles you’ll
get a “no storage memory left” error
(a reboot fixes it till the next time)
The Adventure Begins (and Never Ends…)
18
Then realize that not all devices are created equal. For example:
Kindle Fire (5th Gen) will sometimes
refuse to unlock the screen to run tests
(fixed by installing CyanogenMod)
The Adventure Begins (and Never Ends…)
19
Then realize that not all devices are created equal. For example:
and Samsung Galaxy Tab E
will not charge at all from
anything but a wall charger.
iPad 3 will not charge fast enough and
will end up with an empty battery,
The Adventure Begins (and Never Ends…)
20
Running tests on iOS devices requires:
• Specific version of Appium.
• Specific version of Xcode and Mac OS.
• Specific version of iOS
(in practice it can’t be iOS 10, and once installed, no way back)
• Ability to block all iOS on-the-air updates, otherwise the “Please
update” popup will prevent the tests from running.
• Understanding of numerous MacOS-specific tools.
• Arcane operations with certificates and permissions.
• Certain phase of the Moon.
• Appium will still crash once in a while.
Conclusion
21
• Automated smoke tests worked really well for us.
• Despite complications of initial setup and maintenance, we now
consider them an integral part of our pipeline.
• We found many bugs 
• More importantly, they provide a “safety net” feeling.
• Appium has quirks, but there aren’t many choices around.
• Image processing in general works reasonably well.
• Most problems we had with tests are not related to image
processing (they are basically logical errors).
• These errors are often caused with changes that happen between
the screenshot time and the test response time
(e.g., appearance of a modal dialog window).

More Related Content

What's hot (20)

PDF
How fpgas work when they don't
InfinIT - Innovationsnetværket for it
 
PDF
TMPA-2017: 5W+1H Static Analysis Report Quality Measure
Iosif Itkin
 
PDF
HIS 2015: Alastair F. Donaldson - Fighting for Software Correctness in a Mass...
AdaCore
 
PPT
Mutual exclusion and sync
Dr. C.V. Suresh Babu
 
PPTX
TLA+ and PlusCal / An engineer's perspective
Torao Takami
 
PPTX
Process synchronization
Syed Hassan Ali
 
PPTX
Process synchronization in Operating Systems
Ritu Ranjan Shrivastwa
 
PDF
VL/HCC 2014 - A Longitudinal Study of Programmers' Backtracking
YoungSeok Yoon
 
PPTX
Mutual Exclusion using Peterson's Algorithm
Souvik Roy
 
PPTX
Process synchronization
Ali Ahmad
 
PPTX
RTX Kernal
Team-VLSI-ITMU
 
PDF
Practical RISC-V Random Test Generation using Constraint Programming
ed271828
 
PPTX
Synchronization hardware
Saeram Butt
 
PDF
VaMoS 2022 - Transfer Learning across Distinct Software Systems
Luc Lesoil
 
PPT
Operating Systems - "Chapter 5 Process Synchronization"
Ra'Fat Al-Msie'deen
 
DOCX
Critical section operating system
Muhammad Baqar Kazmi
 
PPTX
Process synchronization
Saad11233
 
DOCX
Operating System Process Synchronization
Haziq Naeem
 
PDF
Automated Testing of Hybrid Simulink/Stateflow Controllers
Lionel Briand
 
PPTX
Concurrency: Mutual Exclusion and Synchronization
Anas Ebrahim
 
How fpgas work when they don't
InfinIT - Innovationsnetværket for it
 
TMPA-2017: 5W+1H Static Analysis Report Quality Measure
Iosif Itkin
 
HIS 2015: Alastair F. Donaldson - Fighting for Software Correctness in a Mass...
AdaCore
 
Mutual exclusion and sync
Dr. C.V. Suresh Babu
 
TLA+ and PlusCal / An engineer's perspective
Torao Takami
 
Process synchronization
Syed Hassan Ali
 
Process synchronization in Operating Systems
Ritu Ranjan Shrivastwa
 
VL/HCC 2014 - A Longitudinal Study of Programmers' Backtracking
YoungSeok Yoon
 
Mutual Exclusion using Peterson's Algorithm
Souvik Roy
 
Process synchronization
Ali Ahmad
 
RTX Kernal
Team-VLSI-ITMU
 
Practical RISC-V Random Test Generation using Constraint Programming
ed271828
 
Synchronization hardware
Saeram Butt
 
VaMoS 2022 - Transfer Learning across Distinct Software Systems
Luc Lesoil
 
Operating Systems - "Chapter 5 Process Synchronization"
Ra'Fat Al-Msie'deen
 
Critical section operating system
Muhammad Baqar Kazmi
 
Process synchronization
Saad11233
 
Operating System Process Synchronization
Haziq Naeem
 
Automated Testing of Hybrid Simulink/Stateflow Controllers
Lionel Briand
 
Concurrency: Mutual Exclusion and Synchronization
Anas Ebrahim
 

Viewers also liked (20)

PDF
TMPA-2017: Vellvm - Verifying the LLVM
Iosif Itkin
 
PDF
TMPA-2017: Compositional Process Model Synthesis based on Interface Patterns
Iosif Itkin
 
PDF
TMPA-2017: Conference Opening
Iosif Itkin
 
PDF
TMPA-2017: Static Checking of Array Objects in JavaScript
Iosif Itkin
 
PDF
TMPA-2017: Generating Cost Aware Covering Arrays For Free
Iosif Itkin
 
PDF
TMPA-2017: Defect Report Classification in Accordance with Areas of Testing
Iosif Itkin
 
PDF
TMPA-2017: Using Functional Directives to Analyze Code Complexity and Communi...
Iosif Itkin
 
PDF
TMPA-2017: A Survey on Model-Based Testing Tools for Test Case Generation
Iosif Itkin
 
PDF
TMPA-2017: Regression Testing with Semiautomatic Test Selection for Auditing ...
Iosif Itkin
 
PDF
TMPA-2017: Layered Layouts for Software Systems Visualization
Iosif Itkin
 
PDF
TMPA-2017: Functional Parser of Markdown Language Based on Monad Combining an...
Iosif Itkin
 
PDF
TMPA-2017: Modeling of PLC-programs by High-level Coloured Petri Nets
Iosif Itkin
 
PDF
TMPA-2017: The Quest for Average Response Time
Iosif Itkin
 
PDF
TMPA-2017: Evolutionary Algorithms in Test Generation for digital systems
Iosif Itkin
 
PDF
TMPA-2017: Predicate Abstraction Based Configurable Method for Data Race Dete...
Iosif Itkin
 
PDF
TMPA-2017: Dl-Check: Dynamic Potential Deadlock Detection Tool for Java Programs
Iosif Itkin
 
PDF
TMPA-2017: Extended Context-Free Grammars Parsing with Generalized LL
Iosif Itkin
 
PDF
TMPA-2017: Simple Type Based Alias Analysis for a VLIW Processor
Iosif Itkin
 
PDF
TMPA-2015: A Need To Specify and Verify Standard Functions
Iosif Itkin
 
PPTX
TMPA-2015: Generation of Test Scenarios for Non Deterministic and Concurrent ...
Iosif Itkin
 
TMPA-2017: Vellvm - Verifying the LLVM
Iosif Itkin
 
TMPA-2017: Compositional Process Model Synthesis based on Interface Patterns
Iosif Itkin
 
TMPA-2017: Conference Opening
Iosif Itkin
 
TMPA-2017: Static Checking of Array Objects in JavaScript
Iosif Itkin
 
TMPA-2017: Generating Cost Aware Covering Arrays For Free
Iosif Itkin
 
TMPA-2017: Defect Report Classification in Accordance with Areas of Testing
Iosif Itkin
 
TMPA-2017: Using Functional Directives to Analyze Code Complexity and Communi...
Iosif Itkin
 
TMPA-2017: A Survey on Model-Based Testing Tools for Test Case Generation
Iosif Itkin
 
TMPA-2017: Regression Testing with Semiautomatic Test Selection for Auditing ...
Iosif Itkin
 
TMPA-2017: Layered Layouts for Software Systems Visualization
Iosif Itkin
 
TMPA-2017: Functional Parser of Markdown Language Based on Monad Combining an...
Iosif Itkin
 
TMPA-2017: Modeling of PLC-programs by High-level Coloured Petri Nets
Iosif Itkin
 
TMPA-2017: The Quest for Average Response Time
Iosif Itkin
 
TMPA-2017: Evolutionary Algorithms in Test Generation for digital systems
Iosif Itkin
 
TMPA-2017: Predicate Abstraction Based Configurable Method for Data Race Dete...
Iosif Itkin
 
TMPA-2017: Dl-Check: Dynamic Potential Deadlock Detection Tool for Java Programs
Iosif Itkin
 
TMPA-2017: Extended Context-Free Grammars Parsing with Generalized LL
Iosif Itkin
 
TMPA-2017: Simple Type Based Alias Analysis for a VLIW Processor
Iosif Itkin
 
TMPA-2015: A Need To Specify and Verify Standard Functions
Iosif Itkin
 
TMPA-2015: Generation of Test Scenarios for Non Deterministic and Concurrent ...
Iosif Itkin
 
Ad

Similar to TMPA-2017: Unity Application Testing Automation with Appium and Image Recognition (20)

PPTX
Android testing
Bitbar
 
PPTX
Appium overview (Selenium Israel #2, Feb. 2014)
danielputerman
 
PDF
[Srijan Wednesday Webinar] Mastering Mobile Test Automation with Appium
Srijan Technologies
 
PDF
Selenium Camp 2016 - Kiev, Ukraine
Justin Ison
 
PPTX
Automated UI Testing for Web and Native Apps on iOS and Android
Operation Mobile
 
PPTX
How to Master Mobile Automation in QA
Oxagile
 
PDF
Android programming-basics
Aravindharamanan S
 
PPTX
Unit Testing in Android
Md Shamsul Arafin Mahtab
 
PDF
2012 java one-con3648
Eing Ong
 
PDF
Emulator vs Simulator vs Real Device.pdf
Jace Reed
 
PPT
Ios - Intorduction to view controller
Vibrant Technologies & Computers
 
PDF
Cucumber meets iPhone
Erin Dees
 
PDF
Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P...
Sauce Labs
 
PPT
Android Application Development Using Java
amaankhan
 
PPTX
Debugging Tips and Tricks - iOS Conf Singapore 2015
Fahim Farook
 
PDF
MOET: Mobile End-to-End Testing
mobiletestsummit
 
DOCX
Android wear notes
Aravindharamanan S
 
DOCX
Android wear notes
Aravindharamanan S
 
PDF
Automated Exploratory Testing
Justin Ison
 
PPT
Synapseindia android apps application
Synapseindiappsdevelopment
 
Android testing
Bitbar
 
Appium overview (Selenium Israel #2, Feb. 2014)
danielputerman
 
[Srijan Wednesday Webinar] Mastering Mobile Test Automation with Appium
Srijan Technologies
 
Selenium Camp 2016 - Kiev, Ukraine
Justin Ison
 
Automated UI Testing for Web and Native Apps on iOS and Android
Operation Mobile
 
How to Master Mobile Automation in QA
Oxagile
 
Android programming-basics
Aravindharamanan S
 
Unit Testing in Android
Md Shamsul Arafin Mahtab
 
2012 java one-con3648
Eing Ong
 
Emulator vs Simulator vs Real Device.pdf
Jace Reed
 
Ios - Intorduction to view controller
Vibrant Technologies & Computers
 
Cucumber meets iPhone
Erin Dees
 
Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P...
Sauce Labs
 
Android Application Development Using Java
amaankhan
 
Debugging Tips and Tricks - iOS Conf Singapore 2015
Fahim Farook
 
MOET: Mobile End-to-End Testing
mobiletestsummit
 
Android wear notes
Aravindharamanan S
 
Android wear notes
Aravindharamanan S
 
Automated Exploratory Testing
Justin Ison
 
Synapseindia android apps application
Synapseindiappsdevelopment
 
Ad

More from Iosif Itkin (20)

PDF
Foundations of Software Testing Lecture 4
Iosif Itkin
 
PPTX
QA Financial Forum London 2021 - Automation in Software Testing. Humans and C...
Iosif Itkin
 
PDF
Exactpro FinTech Webinar - Global Exchanges Test Oracles
Iosif Itkin
 
PDF
Exactpro FinTech Webinar - Global Exchanges FIX Protocol
Iosif Itkin
 
PDF
Operational Resilience in Financial Market Infrastructures
Iosif Itkin
 
PDF
20 Simple Questions from Exactpro for Your Enjoyment This Holiday Season
Iosif Itkin
 
PDF
Testing the Intelligence of your AI
Iosif Itkin
 
PDF
EXTENT 2019: Exactpro Quality Assurance for Financial Market Infrastructures
Iosif Itkin
 
PDF
ClearTH Test Automation Framework: Case Study in IRS & CDS Swaps Lifecycle Mo...
Iosif Itkin
 
PPTX
EXTENT Talks 2019 Tbilisi: Failover and Recovery Test Automation - Ivan Shamrai
Iosif Itkin
 
PDF
EXTENT Talks QA Community Tbilisi 20 April 2019 - Conference Open
Iosif Itkin
 
PDF
User-Assisted Log Analysis for Quality Control of Distributed Fintech Applica...
Iosif Itkin
 
PPTX
QAFF Chicago 2019 - Complex Post-Trade Systems, Requirements Traceability and...
Iosif Itkin
 
PDF
QA Community Saratov: Past, Present, Future (2019-02-08)
Iosif Itkin
 
PDF
Machine Learning and RoboCop Testing
Iosif Itkin
 
PDF
Behaviour Driven Development: Oltre i limiti del possibile
Iosif Itkin
 
PDF
2018 - Exactpro Year in Review
Iosif Itkin
 
PPTX
Exactpro Discussion about Joy and Strategy
Iosif Itkin
 
PPTX
FIX EMEA Conference 2018 - Post Trade Software Testing Challenges
Iosif Itkin
 
PDF
BDD. The Outer Limits. Iosif Itkin at Youcon (in Russian)
Iosif Itkin
 
Foundations of Software Testing Lecture 4
Iosif Itkin
 
QA Financial Forum London 2021 - Automation in Software Testing. Humans and C...
Iosif Itkin
 
Exactpro FinTech Webinar - Global Exchanges Test Oracles
Iosif Itkin
 
Exactpro FinTech Webinar - Global Exchanges FIX Protocol
Iosif Itkin
 
Operational Resilience in Financial Market Infrastructures
Iosif Itkin
 
20 Simple Questions from Exactpro for Your Enjoyment This Holiday Season
Iosif Itkin
 
Testing the Intelligence of your AI
Iosif Itkin
 
EXTENT 2019: Exactpro Quality Assurance for Financial Market Infrastructures
Iosif Itkin
 
ClearTH Test Automation Framework: Case Study in IRS & CDS Swaps Lifecycle Mo...
Iosif Itkin
 
EXTENT Talks 2019 Tbilisi: Failover and Recovery Test Automation - Ivan Shamrai
Iosif Itkin
 
EXTENT Talks QA Community Tbilisi 20 April 2019 - Conference Open
Iosif Itkin
 
User-Assisted Log Analysis for Quality Control of Distributed Fintech Applica...
Iosif Itkin
 
QAFF Chicago 2019 - Complex Post-Trade Systems, Requirements Traceability and...
Iosif Itkin
 
QA Community Saratov: Past, Present, Future (2019-02-08)
Iosif Itkin
 
Machine Learning and RoboCop Testing
Iosif Itkin
 
Behaviour Driven Development: Oltre i limiti del possibile
Iosif Itkin
 
2018 - Exactpro Year in Review
Iosif Itkin
 
Exactpro Discussion about Joy and Strategy
Iosif Itkin
 
FIX EMEA Conference 2018 - Post Trade Software Testing Challenges
Iosif Itkin
 
BDD. The Outer Limits. Iosif Itkin at Youcon (in Russian)
Iosif Itkin
 

Recently uploaded (20)

PDF
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
Edge AI and Vision Alliance
 
PPTX
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
PDF
Hello I'm "AI" Your New _________________
Dr. Tathagat Varma
 
PPTX
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
PDF
Open Source Milvus Vector Database v 2.6
Zilliz
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
5 Things to Consider When Deploying AI in Your Enterprise
Safe Software
 
PDF
Enhancing Environmental Monitoring with Real-Time Data Integration: Leveragin...
Safe Software
 
PDF
From Chatbot to Destroyer of Endpoints - Can ChatGPT Automate EDR Bypasses (1...
Priyanka Aash
 
PPTX
Simplifica la seguridad en la nube y la detección de amenazas con FortiCNAPP
Cristian Garcia G.
 
PDF
My Journey from CAD to BIM: A True Underdog Story
Safe Software
 
PDF
Database Benchmarking for Performance Masterclass: Session 1 - Benchmarking F...
ScyllaDB
 
PDF
“Scaling i.MX Applications Processors’ Native Edge AI with Discrete AI Accele...
Edge AI and Vision Alliance
 
PPTX
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
PDF
UiPath Agentic AI ile Akıllı Otomasyonun Yeni Çağı
UiPathCommunity
 
PDF
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
PDF
Why aren't you using FME Flow's CPU Time?
Safe Software
 
PPTX
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
PDF
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
Earley Information Science
 
DOCX
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
Edge AI and Vision Alliance
 
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
Hello I'm "AI" Your New _________________
Dr. Tathagat Varma
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
Open Source Milvus Vector Database v 2.6
Zilliz
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
5 Things to Consider When Deploying AI in Your Enterprise
Safe Software
 
Enhancing Environmental Monitoring with Real-Time Data Integration: Leveragin...
Safe Software
 
From Chatbot to Destroyer of Endpoints - Can ChatGPT Automate EDR Bypasses (1...
Priyanka Aash
 
Simplifica la seguridad en la nube y la detección de amenazas con FortiCNAPP
Cristian Garcia G.
 
My Journey from CAD to BIM: A True Underdog Story
Safe Software
 
Database Benchmarking for Performance Masterclass: Session 1 - Benchmarking F...
ScyllaDB
 
“Scaling i.MX Applications Processors’ Native Edge AI with Discrete AI Accele...
Edge AI and Vision Alliance
 
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
UiPath Agentic AI ile Akıllı Otomasyonun Yeni Çağı
UiPathCommunity
 
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
Why aren't you using FME Flow's CPU Time?
Safe Software
 
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
Earley Information Science
 
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 

TMPA-2017: Unity Application Testing Automation with Appium and Image Recognition

  • 1. Unity Application Testing Automation with Appium and Image Recognition Maxim Mozgovoy Evgeny Pyshkin University of Aizu, Japan
  • 2. Introducing Automated Smoke Testing • Aimed at performing basic checkups: • Program runs at all. • Program is able to react to user input. • Program is able to connect to perform certain basic functions. • Can be a part of a continuous integration pipeline: • Run automated smoke tests for each new build. • (Already integrated into the Google Play Developer Console). 2
  • 3. The Case of a Mobile Game • Resource-intensive application, may crash or run slowly. • May behave very differently on different devices. • Contains no native GUI controls. Contains elements that are easy to overlook with manual testing. • Stress tests may be beneficial (such as running the app for 5 hours or with poor internet connection). • Real mobile devices required (not emulators / simulators). 3
  • 4. Problem 1: Engineering the Tests How to design and run a GUI / smoke test on a mobile device? De facto standard approach: • Connect mobile devices to a “test server” running some special software. • Execute testing scenarios on a remote machine via the server. 4 Client (runs tests) Server (operates mobile devices)
  • 5. Server Software • Appium: • Can be installed on Mac / Windows / Linux. • Supports test scripts written in Java / JavaScript / Python / C# / etc. • Can test Android, iOS and Windows applications. • Calabash: • Supports Android and iOS applications via different server versions. • Supports Ruby tests scripts only. • Note: these systems work because target platforms explicitly support automation (via adb & UIAutomator on Android, UIAutomation & XCUITest on iOS, etc.) 5
  • 6. Test Scripts • Logically, a test script is a sequence of statements like this: wait 10 sec tap location (100, 50) assert that OK button appears press OK button • In native GUIs Appium can directly access individual controls: 6 e = appium.find_element_by_class_name('android.widget.EditText') e.send_keys("hello") ok = appium.find_element_by_class_name('android.widget.Button') ok.click()
  • 7. Testing Apps with Custom GUI (Unity-made Games) 7 similarity = 0.78 similarity = 0.96 Take screenshots with Appium and use OpenCV to recognize areas via matchTemplate() function. Note: 100% similarity cannot be achieved due to screen rendering differences. In both cases tests are quite slow (inherent limitations)
  • 8. Problem 2: Maintaining a Mobile Farm • Ideally, each new build should be tested on a variety of mobile devices. • Solution: use a cloud mobile farm provider! (AWS, Bitbar, etc.) • Advantages: hassle-free setup, hundreds (!) of mobile devices. • Drawbacks: still not all devices, high costs: 14-17 US¢ per minute per device, while our tests take > 1hr on each device per build (+ stress tests). So, e.g., 5 devices, 1hr ≈ 45 USD. 8 Client Server New build Reports
  • 9. 9 Building Your Own Mobile Farm + Appium + test scripts + Test Runner Software (in-house)
  • 10. Test Runner • Gets fresh builds from TeamCity (build machine) • Runs all tests on all devices. • Generates HTML reports with game action logs and screenshots. • Still under heavy development. 10
  • 11. The Adventure Begins (and Never Ends…) 11 First, you might want to use a small Windows or Linux server It will work perfect with any Android device …but not with iPhone or iPad
  • 12. The Adventure Begins (and Never Ends…) 12 So you’ll have to ditch it and use a Mac
  • 13. The Adventure Begins (and Never Ends…) 13 Then you’ll realize that long tests drain the battery and search for powered USB hubs …will find lots of them…
  • 14. The Adventure Begins (and Never Ends…) 14 …and realize that “powered” means that they simply have some dedicated charging ports and get excited with their specs
  • 15. The Adventure Begins (and Never Ends…) 15 …And finally find the hub that does the job (not without quirks, but nobody’s perfect) …then study its compatibility table:
  • 16. The Adventure Begins (and Never Ends…) 16 Then realize that not all devices are created equal. For example: On Nexus 7 sometimes you need to make 2-3 attempts before an application is installed, it is a norm to get an INSTALL_FAILED_INVALID_URI error with no reason.
  • 17. The Adventure Begins (and Never Ends…) 17 Then realize that not all devices are created equal. For example: On Xiaomi Redmi Note 3 Pro after a number of install / uninstall cycles you’ll get a “no storage memory left” error (a reboot fixes it till the next time)
  • 18. The Adventure Begins (and Never Ends…) 18 Then realize that not all devices are created equal. For example: Kindle Fire (5th Gen) will sometimes refuse to unlock the screen to run tests (fixed by installing CyanogenMod)
  • 19. The Adventure Begins (and Never Ends…) 19 Then realize that not all devices are created equal. For example: and Samsung Galaxy Tab E will not charge at all from anything but a wall charger. iPad 3 will not charge fast enough and will end up with an empty battery,
  • 20. The Adventure Begins (and Never Ends…) 20 Running tests on iOS devices requires: • Specific version of Appium. • Specific version of Xcode and Mac OS. • Specific version of iOS (in practice it can’t be iOS 10, and once installed, no way back) • Ability to block all iOS on-the-air updates, otherwise the “Please update” popup will prevent the tests from running. • Understanding of numerous MacOS-specific tools. • Arcane operations with certificates and permissions. • Certain phase of the Moon. • Appium will still crash once in a while.
  • 21. Conclusion 21 • Automated smoke tests worked really well for us. • Despite complications of initial setup and maintenance, we now consider them an integral part of our pipeline. • We found many bugs  • More importantly, they provide a “safety net” feeling. • Appium has quirks, but there aren’t many choices around. • Image processing in general works reasonably well. • Most problems we had with tests are not related to image processing (they are basically logical errors). • These errors are often caused with changes that happen between the screenshot time and the test response time (e.g., appearance of a modal dialog window).