Diese Präsentation wurde erfolgreich gemeldet.
Die SlideShare-Präsentation wird heruntergeladen. ×

Advanced Appium Tips & Tricks with Jonathan Lipps

Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Wird geladen in …3
×

Hier ansehen

1 von 90 Anzeige

Advanced Appium Tips & Tricks with Jonathan Lipps

Herunterladen, um offline zu lesen

Join Appium expert Jonathan Lipps and Perfecto as we take you through the latest Appium tips and tricks. Find out what’s new with Appium and learn advanced test automation best practices, including:

* Proper use of object identifiers
* Benefits of using deep links to avoid test flakiness
* Cross platform test automation best practices
* Leveraging Appium to test application upgrades

Join Appium expert Jonathan Lipps and Perfecto as we take you through the latest Appium tips and tricks. Find out what’s new with Appium and learn advanced test automation best practices, including:

* Proper use of object identifiers
* Benefits of using deep links to avoid test flakiness
* Cross platform test automation best practices
* Leveraging Appium to test application upgrades

Anzeige
Anzeige

Weitere Verwandte Inhalte

Diashows für Sie (20)

Ähnlich wie Advanced Appium Tips & Tricks with Jonathan Lipps (20)

Anzeige

Weitere von Perfecto by Perforce (20)

Aktuellste (20)

Anzeige

Advanced Appium Tips & Tricks with Jonathan Lipps

  1. 1. Advanced Appium Tips & Tricks Jonathan Lipps • Founding Principal • Cloud Grey 
 @AppiumDevs • @cloudgrey_io • @jlipps • appiumpro.com Perfecto Mobile Webinar · The Internet April 24, 2018
  2. 2. © 2015, Perfecto Mobile Ltd. All Rights Reserved. Housekeeping • Please participate in our live poll and end-of-webinar survey • Ask us questions in the QA panel • We will send you the recording and slides 4/21/2018 2
  3. 3. Founding Principal Architect, Maintainer Jonathan Lipps • Founding Principal • Cloud Grey 
 @AppiumDevs • @cloudgrey_io • @jlipps • appiumpro.com
  4. 4. Appium Update
  5. 5. AppiumConf! @jlipps · cloudgrey.io Watch the videos at appiumconf.com Stay tuned for next year. Thanks for sponsoring, Perfecto!
  6. 6. What’s new in Appium 1.8? @jlipps · cloudgrey.io
  7. 7. W3C WebDriver spec support What’s new in Appium 1.8? @jlipps · cloudgrey.io
  8. 8. W3C WebDriver spec support App management features What’s new in Appium 1.8? @jlipps · cloudgrey.io
  9. 9. W3C WebDriver spec support App management features Improved screen-related primitives What’s new in Appium 1.8? @jlipps · cloudgrey.io
  10. 10. W3C WebDriver spec support App management features Improved screen-related primitives Clipboard management features What’s new in Appium 1.8? @jlipps · cloudgrey.io
  11. 11. W3C WebDriver spec support App management features Improved screen-related primitives Clipboard management features Auxiliary app support via otherApps capability What’s new in Appium 1.8? @jlipps · cloudgrey.io
  12. 12. W3C WebDriver spec support App management features Improved screen-related primitives Clipboard management features Auxiliary app support via otherApps capability iOS Screen Recording What’s new in Appium 1.8? @jlipps · cloudgrey.io
  13. 13. W3C WebDriver spec support App management features Improved screen-related primitives Clipboard management features Auxiliary app support via otherApps capability iOS Screen Recording iOS Performance data gathering via Instruments What’s new in Appium 1.8? @jlipps · cloudgrey.io
  14. 14. W3C WebDriver spec support App management features Improved screen-related primitives Clipboard management features Auxiliary app support via otherApps capability iOS Screen Recording iOS Performance data gathering via Instruments Android Broadcast device logs for log streaming What’s new in Appium 1.8? @jlipps · cloudgrey.io
  15. 15. W3C WebDriver spec support App management features Improved screen-related primitives Clipboard management features Auxiliary app support via otherApps capability iOS Screen Recording iOS Performance data gathering via Instruments Android Broadcast device logs for log streaming Android Support ‘Instant Apps’ What’s new in Appium 1.8? @jlipps · cloudgrey.io
  16. 16. W3C WebDriver spec support App management features Improved screen-related primitives Clipboard management features Auxiliary app support via otherApps capability iOS Screen Recording iOS Performance data gathering via Instruments Android Broadcast device logs for log streaming Android Support ‘Instant Apps’ Many, many bugfixes and performance/stability improvements What’s new in Appium 1.8? @jlipps · cloudgrey.io
  17. 17. @jlipps · cloudgrey.io npm install -g appium
  18. 18. © 2015, Perfecto Mobile Ltd. All Rights Reserved. Poll Question What feature would you most want to see Implemented in Appium? • Support for network virtualization (3G, 4G, packet loss %, etc.) • Support for visual testing (barcode scanning, check deposit use cases) • Support for gesture like Face ID, Finger Print, and more • Better Cross platform automation for all platforms including smartwatch, iOS, Android • Support for audio and video testing (chatbots, MOS, 
 etc.) • Other 4/21/2018 8
  19. 19. Today’s tips: recent selections from appiumpro.com @jlipps · cloudgrey.io
  20. 20. Finding elements with greater speed and stability Today’s tips: recent selections from appiumpro.com @jlipps · cloudgrey.io
  21. 21. Finding elements with greater speed and stability Using deep links to speed up tests and reduce flakiness Today’s tips: recent selections from appiumpro.com @jlipps · cloudgrey.io
  22. 22. Finding elements with greater speed and stability Using deep links to speed up tests and reduce flakiness Testing app upgrade scenarios Today’s tips: recent selections from appiumpro.com @jlipps · cloudgrey.io
  23. 23. Finding elements with greater speed and stability Using deep links to speed up tests and reduce flakiness Testing app upgrade scenarios Cross-platform testing best practices Today’s tips: recent selections from appiumpro.com @jlipps · cloudgrey.io
  24. 24. Element Locators
  25. 25. @jlipps · cloudgrey.io driver.findElement(By.className(“Button”));
  26. 26. @jlipps · cloudgrey.io driver.findElement(By.className(“Button”)); locator strategy
  27. 27. @jlipps · cloudgrey.io driver.findElement(By.className(“Button”)); locator strategy selector
  28. 28. Locator Strategy From Support in Appium class name Selenium Yes id Selenium Yes name Selenium Yes xpath Selenium Yes accessibility id Appium Yes -ios predicate string Appium Yes -ios class chain Appium Yes -android uiautomator Appium Yes -ios uiautomation Appium Deprecated css selector Selenium No link text Selenium No partial link text Selenium No tag name Selenium No @jlipps · cloudgrey.io
  29. 29. Why use XPath? @jlipps · cloudgrey.io
  30. 30. It allows for the formulation of complex queries (for example, using the @contains function) Why use XPath? @jlipps · cloudgrey.io
  31. 31. It allows for the formulation of complex queries (for example, using the @contains function) It can identify any element in the UI hierarchy available to Appium Why use XPath? @jlipps · cloudgrey.io
  32. 32. It allows for the formulation of complex queries (for example, using the @contains function) It can identify any element in the UI hierarchy available to Appium … Why use XPath? @jlipps · cloudgrey.io
  33. 33. It allows for the formulation of complex queries (for example, using the @contains function) It can identify any element in the UI hierarchy available to Appium … that’s about it Why use XPath? @jlipps · cloudgrey.io
  34. 34. Why not to use XPath @jlipps · cloudgrey.io
  35. 35. Why not to use XPath @jlipps · cloudgrey.io Path-based selectors are brittle
  36. 36. Why not to use XPath @jlipps · cloudgrey.io Path-based selectors are brittle It is often expensive to generate an XML representation of the UI
  37. 37. Why not to use XPath @jlipps · cloudgrey.io Path-based selectors are brittle It is often expensive to generate an XML representation of the UI It is often expensive to map XML elements found by XPath to native element objects
  38. 38. Why not to use XPath @jlipps · cloudgrey.io Path-based selectors are brittle It is often expensive to generate an XML representation of the UI It is often expensive to map XML elements found by XPath to native element objects XPath selectors are not cross-platform
  39. 39. Preferred locator strategies @jlipps · cloudgrey.io
  40. 40. Preferred locator strategies @jlipps · cloudgrey.io MobileBy.AccessibilityId Cross-platform locator strategy, will find elements by Accessibility Id (or Name) on iOS, and Content Description on Android
  41. 41. Preferred locator strategies @jlipps · cloudgrey.io MobileBy.AccessibilityId Cross-platform locator strategy, will find elements by Accessibility Id (or Name) on iOS, and Content Description on Android By.id Cross-platform locator strategy, will find elements by Id (and a set of other unique identifiers) on iOS, and android:id on Android
  42. 42. “Advanced” locator strategies @jlipps · cloudgrey.io
  43. 43. “Advanced” locator strategies @jlipps · cloudgrey.io MobileBy.iOSNsPredicateString iOS-only locator strategy that allows complex element lookups based on attributes
  44. 44. “Advanced” locator strategies @jlipps · cloudgrey.io MobileBy.iOSNsPredicateString iOS-only locator strategy that allows complex element lookups based on attributes MobileBy.iOSClassChain iOS-only locator strategy that allows complex element lookups based on attributes and hierarchy
  45. 45. “Advanced” locator strategies @jlipps · cloudgrey.io MobileBy.iOSNsPredicateString iOS-only locator strategy that allows complex element lookups based on attributes MobileBy.iOSClassChain iOS-only locator strategy that allows complex element lookups based on attributes and hierarchy MobileBy.AndroidUIAutomator Android-only locator strategy that allows use the UiSelector API to chain element finding restrictions
  46. 46. iOS Predicate String example @jlipps · cloudgrey.io MobileBy.iOSNsPredicateString( "type == 'XCUIElementTypeButton' AND value BEGINSWITH[c] 'foo' AND visible == 1" );
  47. 47. iOS Class Chain example @jlipps · cloudgrey.io MobileBy.iOSClassChain( "**/XCUIElementTypeCell[`name BEGINSWITH “C"`]/XCUIElementTypeButton[10]" );
  48. 48. Android UiAutomator example @jlipps · cloudgrey.io MobileBy.AndroidUIAutomator( 'new UiSelector().className("ScrollView").getChildByText(new UiSelector().className("android.widget.TextView"), "Tabs")' );
  49. 49. Deep Links
  50. 50. @jlipps · cloudgrey.io
  51. 51. @jlipps · cloudgrey.io ~30 seconds
  52. 52. @jlipps · cloudgrey.io 30 seconds x 50 tests = 25 minutes
  53. 53. Strategies to set up app state instantly @jlipps · cloudgrey.io
  54. 54. Android Start the test with custom intents to navigate directly to the right place Use intentAction and optionalIntentArguments parameters to driver.startActivity Strategies to set up app state instantly @jlipps · cloudgrey.io
  55. 55. Android Start the test with custom intents to navigate directly to the right place Use intentAction and optionalIntentArguments parameters to driver.startActivity iOS Start the app with custom arguments using Appium capabilities Use the processArguments capability when starting a session Strategies to set up app state instantly @jlipps · cloudgrey.io
  56. 56. Android Start the test with custom intents to navigate directly to the right place Use intentAction and optionalIntentArguments parameters to driver.startActivity iOS Start the app with custom arguments using Appium capabilities Use the processArguments capability when starting a session Cross-platform Use deep linking Implement a custom url scheme in your app, then simply use driver.get Strategies to set up app state instantly @jlipps · cloudgrey.io
  57. 57. @jlipps · cloudgrey.io yourapp://test/login/:username/:password
  58. 58. @jlipps · cloudgrey.io
  59. 59. @jlipps · cloudgrey.io ~5 seconds
  60. 60. @jlipps · cloudgrey.io 5 seconds x 50 tests = ~4 minutes
  61. 61. Testing App Upgrades
  62. 62. App upgrades on Android @jlipps · cloudgrey.io
  63. 63. Get paths to two versions of your app App upgrades on Android @jlipps · cloudgrey.io
  64. 64. Get paths to two versions of your app Start an Appium session using the older version of the app (via the app capability) App upgrades on Android @jlipps · cloudgrey.io
  65. 65. Get paths to two versions of your app Start an Appium session using the older version of the app (via the app capability) Install the new app using driver.installApp App upgrades on Android @jlipps · cloudgrey.io
  66. 66. Get paths to two versions of your app Start an Appium session using the older version of the app (via the app capability) Install the new app using driver.installApp Trigger the new app to relaunch by using driver.startActivity App upgrades on Android @jlipps · cloudgrey.io
  67. 67. @jlipps · cloudgrey.io
  68. 68. App upgrades on iOS @jlipps · cloudgrey.io
  69. 69. Get paths to two versions of your app App upgrades on iOS @jlipps · cloudgrey.io
  70. 70. Get paths to two versions of your app Start an Appium session using the older version of the app (via the app capability) App upgrades on iOS @jlipps · cloudgrey.io
  71. 71. Get paths to two versions of your app Start an Appium session using the older version of the app (via the app capability) Stop the current app using mobile: terminateApp App upgrades on iOS @jlipps · cloudgrey.io
  72. 72. Get paths to two versions of your app Start an Appium session using the older version of the app (via the app capability) Stop the current app using mobile: terminateApp Install the new app using mobile: installApp App upgrades on iOS @jlipps · cloudgrey.io
  73. 73. Get paths to two versions of your app Start an Appium session using the older version of the app (via the app capability) Stop the current app using mobile: terminateApp Install the new app using mobile: installApp Trigger the new app to relaunch by using mobile: launchApp App upgrades on iOS @jlipps · cloudgrey.io
  74. 74. @jlipps · cloudgrey.io
  75. 75. Cross-platform Tips
  76. 76. Tips for app development @jlipps · cloudgrey.io
  77. 77. Add labels to any element that might be used in testing (i.e., pretty much every element) Tips for app development @jlipps · cloudgrey.io
  78. 78. Add labels to any element that might be used in testing (i.e., pretty much every element) Add labels as “Accessibility ID” on iOS and “Content Description” on Android—and make them the same! Tips for app development @jlipps · cloudgrey.io
  79. 79. Add labels to any element that might be used in testing (i.e., pretty much every element) Add labels as “Accessibility ID” on iOS and “Content Description” on Android—and make them the same! As much as possible within the product design requirements, keep user flows the same across apps Tips for app development @jlipps · cloudgrey.io
  80. 80. Add labels to any element that might be used in testing (i.e., pretty much every element) Add labels as “Accessibility ID” on iOS and “Content Description” on Android—and make them the same! As much as possible within the product design requirements, keep user flows the same across apps Build a test version of your app that has all kinds of state set-up goodies Tips for app development @jlipps · cloudgrey.io
  81. 81. Add labels to any element that might be used in testing (i.e., pretty much every element) Add labels as “Accessibility ID” on iOS and “Content Description” on Android—and make them the same! As much as possible within the product design requirements, keep user flows the same across apps Build a test version of your app that has all kinds of state set-up goodies Make debug versions of builds Tips for app development @jlipps · cloudgrey.io
  82. 82. Add labels to any element that might be used in testing (i.e., pretty much every element) Add labels as “Accessibility ID” on iOS and “Content Description” on Android—and make them the same! As much as possible within the product design requirements, keep user flows the same across apps Build a test version of your app that has all kinds of state set-up goodies Make debug versions of builds iOS Use Wildcard App IDs in Provisioning Profiles (so WebDriverAgent can be built using a custom Bundle ID that works with the profile) Tips for app development @jlipps · cloudgrey.io
  83. 83. Tips for the testsuite @jlipps · cloudgrey.io
  84. 84. Use a Page Object Model strategy (or similar), to keep differences between platforms encapsulated Tips for the testsuite @jlipps · cloudgrey.io
  85. 85. Use a Page Object Model strategy (or similar), to keep differences between platforms encapsulated Test step code should be totally platform-agnostic. Only your runner and your object model should know about platform Tips for the testsuite @jlipps · cloudgrey.io
  86. 86. Use a Page Object Model strategy (or similar), to keep differences between platforms encapsulated Test step code should be totally platform-agnostic. Only your runner and your object model should know about platform Avoid XPath in favor of cross-platform locator strategies Tips for the testsuite @jlipps · cloudgrey.io
  87. 87. Use a Page Object Model strategy (or similar), to keep differences between platforms encapsulated Test step code should be totally platform-agnostic. Only your runner and your object model should know about platform Avoid XPath in favor of cross-platform locator strategies Dynamically update test name for reports to include platform name or other details, for easier debugging Tips for the testsuite @jlipps · cloudgrey.io
  88. 88. @jlipps · cloudgrey.io More tips like these sent by e-mail every week Subscribe at appiumpro.com
  89. 89. Thank You! Your free weekly Appium newsletter: appiumpro.com Jonathan Lipps • Founding Principal • Cloud Grey 
 @AppiumDevs • @cloudgrey_io • @jlipps • appiumpro.com
  90. 90. Questions? Your free weekly Appium newsletter: appiumpro.com Jonathan Lipps • Founding Principal • Cloud Grey 
 @AppiumDevs • @cloudgrey_io • @jlipps • appiumpro.com

×