2.30M
Category: programmingprogramming

Automation of mobile testing: tips and tricks. Plan

1.

Automation
of mobile testing:
tips and tricks
1

2.

Plan
Basic tools
How to write auto-tests for mobile apps
Basics of Mobile Cloud Services
Tips and tricks
2

3.

Minimize Desired Capabilities
Absolutely necessary set of capabilities
(for Appium DT):
MobileCapabilityType.DEVICE_NAME (emulator-5554, e4da6adc, SAMSUNG SM-J320F)
MobileCapabilityType.PLATFORM_NAME (Android, iOS)
MobileCapabilityType.BROWSER_NAME (Chrome)
Or
MobileCapabilityType.APP (ContactTest.app, *.app)
3

4.

Other recommended capabilities
We had no need in these as you could see:
(for Appium DT):
MobileCapabilityType.AUTOMATION_NAME (Selendroid, UI Automator)
MobileCapabilityType.PLATFORM_VERSION
capabilities.setCapability("appPackage","com.package.some")
AndroidMobileCapabilityType.APP_PACKAGE
capabilities.setCapability("appActivity",".SomeActivity")
AndroidMobileCapabilityType.APP_ACTIVITY
There are also specific IOSMobileCapabilityType
4

5.

Appium tests:
DOs and DON’Ts
5

6.

DONTs
1. Don’t connect devices on the 3rd party computer
that is not under your control
2. Don’t create separate tests for separate platforms
(use abstractions, patterns, JDI)
3. Don’t disable debug logging level for test execution
4. Don’t place in configurational JSON-files parameters
that you don’t understand
6

7.

DOs
1. Use real devices instead simulators/emulators for more
authentic results
2. Use physical (USB) connection for devices instead Wi-Fi one
for more stable appium-device connection
3. Use configurational JSON-files for devices to make
preferences tweaking more flexible
4. Use multithreading to run your tests in parallel to speed-up
test execution
5. Use PageObjects
6. Create cross-platform tests
7

8.

Hints
Switch on/off, awaiking from sleeping mode, transition to background mode
and back
Notifications – local and server
Use sniffers and proxy for traffic monitoring (e.g. Charles)
Check access to default services: Gallery, Camera, Microphone and so on
Feedback form
Remember about platforms specifics
Security certificates: for test environment and prod/pre-prod
Have enough time for testing
Be in touch with a team
8

9.

Element Locator
Strategies
9

10.

WARNING!
Please note, that
@FindBy requires PageInit() that can leads to some
problems at web/mobile elements usage.
E.g., Stale Element Reference Exception.
JS and AJAX pages are well-known sources of these
problems.
There are alternative implementations of PageObject
pattern
i.e. https://automatetheplanet.com/advanced-page-object-pattern/
10

11.

Mobile native elements
11

12.

Cross-platform native elements
Such element theoretically can be used in the same tests for
Android and iOS implementation of the same application.
12

13.

Add strategy for web elements
Extend previous
strategy to web
application.
Note that
RemoteWebElement
is used.
13

14.

Chained locators, way 1
14

15.

Chained locators, way 2
15

16.

Any possible locators
16

17.

@FindBys and @FindAll
@FindBys : the required WebElement objects need to
match all of the given criteria
@FindAll : the required WebElement objects need to
match at least one of the given criteria
17

18.

Combined variants for
target platforms, way 1
18

19.

Combined variants for
target platforms, way 2
19

20.

Appium widgets for
any group of element
20

21.

Other annotations
of @FindBy family
You can find a lot of other annotations of @FindBy family in the
latest version of Appium Java client
Android
@AndroidFindAll
@AndroidFindByAllSet
@AndroidFindByChainSet
@AndroidFindBys
@AndroidFindBySet
iOS
@iOSFindAll
@iOSFindByAllSet
@iOSFindByChainSet
@iOSFindBys
@iOSFindBySet
21

22.

Useful links
KB page with basics
https://kb.epam.com/display/EPMCTSTRCP/How+to+create+a+first+test+
with+Appium
Appium server flags description
https://github.com/appium/appium/blob/master/docs/en/writingrunning-appium/server-args.md
Appium setup for iOS
http://appium.io/docs/en/drivers/ios-xcuitest/index.html
Appium setup for Android http://appium.io/docs/en/drivers/androiduiautomator2/index.html
Appium Desktop Inspector
http://www.automationtestinghub.com/appium-desktop-inspectorinspect-mobile-elements/
22

23.

Plan
Basic tools
How to write auto-tests for mobile apps
Basics of Mobile Cloud Services
Tips and tricks
23

24.

QUESTIONS
maxim.mescheryakov
[email protected]
24
English     Русский Rules