際際滷

際際滷Share a Scribd company logo
AN OVERVIEW
OF
Appium
Feb. 2014
Daniel Puterman (LinkedIn, twitter)
Sr. developer
whoami?
 Been programming forever.
 Currently lead developer at Applitools (check out our intro video).
 Before:






Vioozer
iCircl
Matrix
Beyond Security
.

 Team leader, Developer, Entreprenuer.
APPIUM AUTOMATES MOBILE
APPS
Appium is an open source test
automation framework for use with native
and hybrid mobile apps.
A rising star..
DEMO
Code for the demo available in:
https://github.com/danielputerman/appium-overview
Automating with Appium
Appium was created with 4 design goals in mind:

 Test the same app you submit to the market place.
 Write tests in any language, on any platform.
 Use standard automation specification / api.
 Open source.
Soooo Ummmm
WebDriver!
How does it work?

UIAutomator

Test Code
Instruments
意鞄艶姻艶韓看姻艶
ONE
SCRIPT
TO
RULE
THEM
ALL
No Proprietary IDE / Language
OPEN SOURCE
https://github.com/appium/appium/blob/master/LICENSE

APACHE LICENSE 2.0
Supported platforms

 Native & Hybrid apps
 Real devices & Simulators
 Available also on the grid (e.g., SauceLabs)

And.
 Even works with Robots
A little deeper: Android
A little deeper: iOS
Show me the code!
Code for available in:
https://github.com/danielputerman/appium-overview
Finding elements
Appium translates webdriver find commands to the relevant
automation API provided by each platform:
Four find methods available
 name: The text on the element / accessibility identifier
 tag_name: the type of an element, e.g., button, textfield etc.
 Mapping:
https://github.com/appium/appium/blob/master/lib/devices/ios/uiauto/lib/mechanic.js
#L29

 Xpath: Using the element hierarchy.
 ID: Available for Android when running with selendroid as device.
Finding elements by name
driver.find_element(:name, New note)
Searches label text / accessibility fields for each platform (contentDescription on android, name on iOS)
Finding elements by tag name
driver.find_element(:tag_name, textfield)
Searches for an element of the specified type.
Finding elements by xpath
@driver.find_element(:xpath, '//text[contains(@value, another)]')
@driver.find_element(:xpath, '//text[last()]')
There are limitations, of course!
 Instruments is a singleton
 No parallel testing of iOS apps on the same OSX instance.
 Limited VM scalability.

 Appium is a relatively new product and is in the process of maturing.
 Documentation is not bad, but can be improved quite a bit.
 Error messages (especially for iOS) can be sometimes hard to figure
out.
The future
 Mobile Json Wire Protocol (part of
Selenium 3)
https://code.google.com/p/selenium/source/
browse/spec-draft.md?repo=mobile
 Joint effort of Appium, Facebook, Ebay and Mozilla
 Appium would implement the protocol + backword
compatibility.

 Additional platforms
 Appium Doctor
 Advanced gestures
Tips I: Appium setup
 Pay attention to the requirements!
 Node version (>= 0.8)
 Android API >= 17 (i.e. 4.2.2 and above)
 Windows is still considered beta, though seems to be working fine 

 iOS
 Mac OS X 10.7 or higher, 10.8.4 recommended
 XCode >= 4.6.3
 Apple Developer Tools (iPhone simulator SDK, command line tools)

 For Mac, make sure you use the XCode version matching the iOS
version you wish to test
 https://github.com/appium/appium/blob/master/docs/running-on-osx.md#testing-against-multiple-ios-sdks
Tips II: running Appium
 Desired capabilities, Desired capabilities, Desired capabilities!
 On linux/Mac use sudo E (or sudo sE) to have the environment
variables available when Appium is run.
 Notice the IP you listen to when starting Appium (the -a parameter):
 127.0.0.1 will only listen to itself and localhost.
 0.0.0.0 will listen to itself, localhost, 127.0.0.1 and the actual computer IP(s).

 Parallel testing?
 Run multiple Appium servers, each listening to a different port, and to a
specific device using the U option.

 Use full-reset when running on Android, so tests will start from a
clean environment.
FAQ
Q: Can I automate webview applications?
A: Definitely.
1.
2.
3.
4.

If youre using Android, the device in the desired capabilities should be set to
selendroid.
Switch to webview: driver.switch_to_window(WEBVIEW)
Automate as standard web.
If required: driver.switch_to_window(NATIVE)

Q: What about an application which activates another application? (FB, maps etc.)
A: Depends
 For Android, not a problem.
 For iOS, switching to a different application loses the context in which the automation run.
You need to create a new session when coming back from the external application.
https://groups.google.com/forum/#!topic/appium-discuss/38wLkiS_7L0
FAQ Cont.
Q: Can I automate an application already installed on a device (without having the app file
on my computer)?

A: Yes and no 
 Android: You can, either for simulator or for real device (just set app-package and app-activity).
 iOS: No problem if you use a simulator (use bundleId as the value to the app parameter), but for a
real device you must have the app file on your computer.
UI Validation
DEMO
Code for available in:
https://github.com/danielputerman/appium-overview
Additional resources
 Appium website
 Home: http://appium.io/
 Documentation: http://appium.io/getting-started.html

 Appium forum on google. If you have a question or a problem, this is
the place to go.
 https://groups.google.com/forum/#!forum/appium-discuss

 Code for the demos
 https://github.com/danielputerman/appium-overview
Thanks!

More Related Content

Appium overview (Selenium Israel #2, Feb. 2014)

  • 1. AN OVERVIEW OF Appium Feb. 2014 Daniel Puterman (LinkedIn, twitter) Sr. developer
  • 2. whoami? Been programming forever. Currently lead developer at Applitools (check out our intro video). Before: Vioozer iCircl Matrix Beyond Security . Team leader, Developer, Entreprenuer.
  • 3. APPIUM AUTOMATES MOBILE APPS Appium is an open source test automation framework for use with native and hybrid mobile apps.
  • 5. DEMO Code for the demo available in: https://github.com/danielputerman/appium-overview
  • 6. Automating with Appium Appium was created with 4 design goals in mind: Test the same app you submit to the market place. Write tests in any language, on any platform. Use standard automation specification / api. Open source. Soooo Ummmm
  • 8. How does it work? UIAutomator Test Code Instruments
  • 11. No Proprietary IDE / Language
  • 13. Supported platforms Native & Hybrid apps Real devices & Simulators Available also on the grid (e.g., SauceLabs) And. Even works with Robots
  • 14. A little deeper: Android
  • 16. Show me the code! Code for available in: https://github.com/danielputerman/appium-overview
  • 17. Finding elements Appium translates webdriver find commands to the relevant automation API provided by each platform: Four find methods available name: The text on the element / accessibility identifier tag_name: the type of an element, e.g., button, textfield etc. Mapping: https://github.com/appium/appium/blob/master/lib/devices/ios/uiauto/lib/mechanic.js #L29 Xpath: Using the element hierarchy. ID: Available for Android when running with selendroid as device.
  • 18. Finding elements by name driver.find_element(:name, New note) Searches label text / accessibility fields for each platform (contentDescription on android, name on iOS)
  • 19. Finding elements by tag name driver.find_element(:tag_name, textfield) Searches for an element of the specified type.
  • 20. Finding elements by xpath @driver.find_element(:xpath, '//text[contains(@value, another)]') @driver.find_element(:xpath, '//text[last()]')
  • 21. There are limitations, of course! Instruments is a singleton No parallel testing of iOS apps on the same OSX instance. Limited VM scalability. Appium is a relatively new product and is in the process of maturing. Documentation is not bad, but can be improved quite a bit. Error messages (especially for iOS) can be sometimes hard to figure out.
  • 22. The future Mobile Json Wire Protocol (part of Selenium 3) https://code.google.com/p/selenium/source/ browse/spec-draft.md?repo=mobile Joint effort of Appium, Facebook, Ebay and Mozilla Appium would implement the protocol + backword compatibility. Additional platforms Appium Doctor Advanced gestures
  • 23. Tips I: Appium setup Pay attention to the requirements! Node version (>= 0.8) Android API >= 17 (i.e. 4.2.2 and above) Windows is still considered beta, though seems to be working fine iOS Mac OS X 10.7 or higher, 10.8.4 recommended XCode >= 4.6.3 Apple Developer Tools (iPhone simulator SDK, command line tools) For Mac, make sure you use the XCode version matching the iOS version you wish to test https://github.com/appium/appium/blob/master/docs/running-on-osx.md#testing-against-multiple-ios-sdks
  • 24. Tips II: running Appium Desired capabilities, Desired capabilities, Desired capabilities! On linux/Mac use sudo E (or sudo sE) to have the environment variables available when Appium is run. Notice the IP you listen to when starting Appium (the -a parameter): 127.0.0.1 will only listen to itself and localhost. 0.0.0.0 will listen to itself, localhost, 127.0.0.1 and the actual computer IP(s). Parallel testing? Run multiple Appium servers, each listening to a different port, and to a specific device using the U option. Use full-reset when running on Android, so tests will start from a clean environment.
  • 25. FAQ Q: Can I automate webview applications? A: Definitely. 1. 2. 3. 4. If youre using Android, the device in the desired capabilities should be set to selendroid. Switch to webview: driver.switch_to_window(WEBVIEW) Automate as standard web. If required: driver.switch_to_window(NATIVE) Q: What about an application which activates another application? (FB, maps etc.) A: Depends For Android, not a problem. For iOS, switching to a different application loses the context in which the automation run. You need to create a new session when coming back from the external application. https://groups.google.com/forum/#!topic/appium-discuss/38wLkiS_7L0
  • 26. FAQ Cont. Q: Can I automate an application already installed on a device (without having the app file on my computer)? A: Yes and no Android: You can, either for simulator or for real device (just set app-package and app-activity). iOS: No problem if you use a simulator (use bundleId as the value to the app parameter), but for a real device you must have the app file on your computer.
  • 27. UI Validation DEMO Code for available in: https://github.com/danielputerman/appium-overview
  • 28. Additional resources Appium website Home: http://appium.io/ Documentation: http://appium.io/getting-started.html Appium forum on google. If you have a question or a problem, this is the place to go. https://groups.google.com/forum/#!forum/appium-discuss Code for the demos https://github.com/danielputerman/appium-overview