3. It’s not about:
✘ Appium vs Espresso / XCUITest
✘ Real devices vs emulators
✘ Sauce Labs vs other cloud providers
3
But:
✘ Get familiar with potential challenges
✘ Minimize test flakiness and get the most out of Appium
✘ Stabilize test execution in real device cloud
6. Keep in mind while using Appium
✘ Install app only once
6
✘ Stop using bad locators
✘ Implicit wait = sleep = bad practice
✘ Every appium call counts
✘ Take care of keyboard
✘ Use API to generate test data / change app status
✘ Start activity / relaunch app / deep links between tests
7. Fast tests = Avoid using XPath
Fast & reliable locators
✘ id
✘ Accessibility id
✘ Predicate string
7
8. “- Don’t you ever use XPath?
8
XPath of total locators (~200):
Android: 6%
iOS: 4%
- I do. Only when really necessary
9. 9
Starting using device cloud like...
Source: http://en.espn.co.uk/f1/motorsport/image/6007.html
12. Be careful with version you use
12
appium-base-driver@3.12.0
appium-xcuitest-driver@2.102.0
appium-xcode@3.7.2
WebDriverAgent
appium-ios-driver@2.13.0
… 40+ modules
java-client@6.1.0
python-client@0.31
ruby-lib@9.16.0
wd@1.11.0
webdriverio@4.14.0
Server Client
13. Cloud is black box
13
appium-base-driver@3.12.0
appium-xcuitest-driver@2.102.0
appium-xcode@3.7.2
WebDriverAgent
appium-ios-driver@2.13.0
… 40+ modules
java-client@6.1.0
python-client@0.31
ruby-lib@9.16.0
wd@1.11.0
webdriverio@4.14.0
Server Client
In Cloud only release version:
1.9.1
1.8.1
1.8.0
1.7.2
15. Devices have different:
15
✘ OS version
✘ Manufacture customized OS
✘ DPI / Screen resolution
✘ CPU / RAM
✘ Default connectivity type
✘ Keyboard
✘ Preinstalled apps
18. Define device for test run
API:
/available
18
Filter
matrix
Select
random
Start
session
Dynamic allocation
filter by OS version & device type
static
19. UI Automator
Search for hidden elements inside scrollable View
findElementByUIAutomator(“new UiScrollable(new UiSelector()...”)
19
24. Check language on session start
✘ Check the element text on login
✘ Change via switch button
In worst case
✘ Skip tests with localisation checks
24
26. Once in a while getting exception
UnknownError - An unknown
server-side error occurred
while processing the
command. Selenium error: Lost
contact with app, please check
Appium log for more
information
The environment you
requested was unavailable.
Unable to install app to the
device XXX.
Unable to allocate device YYY
within 900000ms or 3 tries.
This can happen if there were
no available devices within the
time or your plan's max
concurrent test run is not
corresponding to your usage
26
28. 3 iterations of custom mechanism
Version 1
Pull device matrix
Get available devices via API
Filter matrix with available
Select random one for session
Dynamic allocation
Version 2
Run v1 for EU device cluster
Run v1 for US device cluster
Dynamic allocation
Version 3
Run v2
Catch session creation error
Add device to “black list”
Retry v2 with black list filter
28
34. Custom sesion restart timeout
1. Define own session restart timeout (5 - 7 min)
2. Start session with time counter and enabled device caching
3. Starting from 2nd test check timeout - counter > max_test_time
4. Restart session before N test when timeout reached
5. Save result in SL, get report link, continue execution
34
38. Make Appium a better tool
Follow the progress:
Image comparison:
https://github.com/appium/appium/blob/
master/docs/en/writing-running-appium/
image-comparison.md
Element find plugins:
https://github.com/appium/appium/blob/
master/docs/en/advanced-concepts/ele
ment-finding-plugins.md
Contribute:
✘ Create issues
✘ Add/translate docs
✘ Answer questions
✘ Add new functionality
✘ Support client libraries
38
39. Let’s summarize:
39
✘ Follow the best practices with Appium
✘ Don’t try to support tests for all the devices in cloud
✘ Make sure to set correct connection and language on device
✘ Don’t fully rely on cloud with device allocation
✘ Be critical to test time execution, try to improve