build mobile application that is easy to automate
TRANSCRIPT
![Page 1: Build mobile application that is easy to automate](https://reader035.vdocument.in/reader035/viewer/2022062823/587250091a28ab852f8b6d6d/html5/thumbnails/1.jpg)
How to Build a Mobile Application that is Easy to Automate?Jun 2016
![Page 2: Build mobile application that is easy to automate](https://reader035.vdocument.in/reader035/viewer/2022062823/587250091a28ab852f8b6d6d/html5/thumbnails/2.jpg)
HOW TO BUILD A MOBILE APPLICATION THAT IS EASY TO AUTOMATE?
Select Technology Object identification background and challenges Xpath / Indexs Properties and considerations in Object identification Application navigation UI component, Layout and Others, Synchronization
![Page 3: Build mobile application that is easy to automate](https://reader035.vdocument.in/reader035/viewer/2022062823/587250091a28ab852f8b6d6d/html5/thumbnails/3.jpg)
The technology you use has a big impact on the automation process. Using common technology removes risks.
There are 3 types of UI objects:• Native objects – using the OS native objects. The native objects can be
created directly or using some kind of framework (like Xamarin).• Web objects- run inside WebView (like Phonegap)• Proprietary objects- new set of UI elements (like Adobe Flash)
Avoid technologies that are not model based
TRY TO AVOID THIS OPTION
SELECTED TECHNOLOGY
![Page 4: Build mobile application that is easy to automate](https://reader035.vdocument.in/reader035/viewer/2022062823/587250091a28ab852f8b6d6d/html5/thumbnails/4.jpg)
The main challenge in mobile automation is identifying UI elements.• Automation tool sees UI as tree of nodes• One element can contain other elements• Every node has properties• Common properties: text, id, hint, accessibility label, placeholder
A query needs to be created in order to identify an element.
CHALLENGE #1: OBJECT IDENTIFICATION
![Page 5: Build mobile application that is easy to automate](https://reader035.vdocument.in/reader035/viewer/2022062823/587250091a28ab852f8b6d6d/html5/thumbnails/5.jpg)
Syntax:Xpath=//*[@text=‘OK’]//- scan the UI tree from the root.*- find any node (don’t care about the node name)[]- that (condition)@- the property (in this case text)
Xpath is a very common technology for identifying UI objects.
XPath
![Page 6: Build mobile application that is easy to automate](https://reader035.vdocument.in/reader035/viewer/2022062823/587250091a28ab852f8b6d6d/html5/thumbnails/6.jpg)
Index
What if we have more than one element that match the quarry?
• The tool will usually will select the first element in the UI
(in some tools it will be visual order, other tools will use node hierarchy order).
• Relaying your identification on index is not a good sign for your automation robastness
![Page 7: Build mobile application that is easy to automate](https://reader035.vdocument.in/reader035/viewer/2022062823/587250091a28ab852f8b6d6d/html5/thumbnails/7.jpg)
Things to consider when using properties to identify objects:• Property visibility – text / placeholder is visible to the user• Uniqueness – id is unique for web• Multilingual support• Multi-platform – text / class / placeholder …• Not dynamic• Easy to query• Fast to query – isVisable sometime can be slow to query
CONSIDERATIONS IN OBJECT IDENTIFICATION
![Page 8: Build mobile application that is easy to automate](https://reader035.vdocument.in/reader035/viewer/2022062823/587250091a28ab852f8b6d6d/html5/thumbnails/8.jpg)
Field name OS Pros. Cons.AccessibilityIdentif
y/ ContentDescriptio
nAndroid/iOS
Usually unique Not dynamic Support multi lingual
Needs development attention / awareness
Id Web Unique Fast to query
In some technologies it is auto generated and can change in new versions
Id Android Very command Effortless Multilingual Not Unique
Hint/Placeholder Android/iOS Visible Effortless Does not change with
the field content Inapplicable for multi lingual apps
Class Android/iOS Effortless Will probably require index
AccessibilityLabel iOS Effortless Good option for
images Dynamic with the text Inapplicable for multi lingual apps
Text Android/iOS/Web
Visible Unique in many cases Effortless
Can be dynamic Inapplicable for multi lingual apps
CONSIDERATIONS IN OBJECT IDENTIFICATION
![Page 9: Build mobile application that is easy to automate](https://reader035.vdocument.in/reader035/viewer/2022062823/587250091a28ab852f8b6d6d/html5/thumbnails/9.jpg)
For Automation to be successful the operation that is build should be stateless. Try to avoid unnecessary state full operations.
Stateless = executes any operation regardless of current state/page• Example for a stateless operation: top menu button• Example for a state-full operation: login process, first user flow
APPLICATION NAVIGATION SHOULD BE EASY
![Page 10: Build mobile application that is easy to automate](https://reader035.vdocument.in/reader035/viewer/2022062823/587250091a28ab852f8b6d6d/html5/thumbnails/10.jpg)
Proprietary UI elements- try to avoid using customized UI elements
UI COMPONENT, LAYOUT AND OTHERS
![Page 11: Build mobile application that is easy to automate](https://reader035.vdocument.in/reader035/viewer/2022062823/587250091a28ab852f8b6d6d/html5/thumbnails/11.jpg)
Don’t tweak the UI object events.
UI COMPONENT, LAYOUT AND OTHERS
![Page 12: Build mobile application that is easy to automate](https://reader035.vdocument.in/reader035/viewer/2022062823/587250091a28ab852f8b6d6d/html5/thumbnails/12.jpg)
Avoid using complex layers.
UI COMPONENT, LAYOUT AND OTHERS
![Page 13: Build mobile application that is easy to automate](https://reader035.vdocument.in/reader035/viewer/2022062823/587250091a28ab852f8b6d6d/html5/thumbnails/13.jpg)
The problem: clicking on an element that is not ready to receive the event
UI Synchronization
![Page 14: Build mobile application that is easy to automate](https://reader035.vdocument.in/reader035/viewer/2022062823/587250091a28ab852f8b6d6d/html5/thumbnails/14.jpg)
• Provide API on the server side for common operation: (Create User / Account)
• Manage common tests resource
Test configuration