Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Mobile testing in the cloud

141 views

Published on

Android has a fragmented ecosystem. There are devices out there with square screens or even no 3G antenna. It’s impossible to test on all of them. But if we write automated tests, then maybe we could run these tests on hundreds of real devices in the cloud. Let’s compare Espresso to Appium and Amazon Device Farm to Firebase Device Lab and see which of these we like more.

Published in: Mobile
  • Be the first to comment

  • Be the first to like this

Mobile testing in the cloud

  1. 1. Mobile testing in the cloud Andrei Diaconu
  2. 2. http://www.andreidiaconu.com http://www.androidiasi.ro Andrei Diaconu Android Iasi Me
  3. 3. 1. Mobile testing 2. in the cloud
  4. 4. 2 Options Simple Java Unit Tests UI tests
  5. 5. 2 Options Simple Java Unit Tests UI tests Test components in isolation Super fast
  6. 6. 2 Options Simple Java Unit Tests UI tests Test components in isolation Super fast Simulate user interaction Slow and need Android
  7. 7. +
  8. 8. Inside man Outside man
  9. 9. Inside man Outside man • Access to code • Can change anything • Can simulate situations • Uses accessibility • Simulates a user • Can run on any app
  10. 10. Inside man Outside man
  11. 11. Inside man Outside man Instrumentation Framework UiAutomator
  12. 12. Inside man Outside man
  13. 13. How they work
  14. 14. UiAutomator AppiumDriver JUnit
  15. 15. Instrumentation Framework JUnit
  16. 16. Instrumentation Framework UiAutomator JUnit
  17. 17. Let's validate this scenario
  18. 18. onView(withText("Favorites"))
 .perform(click()); 
 onView(withId(R.id.swipe_to_refresh))
 .perform(swipeDown());
 
 onView(withText(containsString("There are no Sessions")))
 .check(matches(isDisplayed()));
  19. 19. onView(withText("Favorites"))
 .perform(click()); 
 onView(withId(R.id.swipe_to_refresh))
 .perform(swipeDown());
 
 onView(withText(containsString("There are no Sessions")))
 .check(matches(isDisplayed()));
  20. 20. onView(withText("Favorites"))
 .perform(click()); 
 onView(withId(R.id.swipe_to_refresh))
 .perform(swipeDown());
 
 onView(withText(containsString("There are no Sessions")))
 .check(matches(isDisplayed()));
  21. 21. Let's validate this scenario
  22. 22. Record from Android Studio
  23. 23. driver .findElement(containsText("Favorites"))
 .click(); 
 driver.swipe(300, 300, 300, 600, 1500);
 
 assertTrue( driver .findElement(containsText("There are no Sessions"))
 .isDisplayed()); ... private By containsText(String text){
 return By.xpath("//*[contains(@text,'"+text+"')]");
 }
  24. 24. driver .findElement(containsText("Favorites"))
 .click(); 
 driver.swipe(300, 300, 300, 600, 1500);
 
 assertTrue( driver .findElement(containsText("There are no Sessions"))
 .isDisplayed()); ... private By containsText(String text){
 return By.xpath("//*[contains(@text,'"+text+"')]");
 }
  25. 25. driver .findElement(containsText("Favorites"))
 .click(); 
 driver.swipe(300, 300, 300, 600, 1500);
 
 assertTrue( driver .findElement(containsText("There are no Sessions"))
 .isDisplayed()); ... private By containsText(String text){
 return By.xpath("//*[contains(@text,'"+text+"')]");
 }
  26. 26. driver .findElement(containsText("Favorites"))
 .click(); 
 driver.swipe(300, 300, 300, 600, 1500);
 
 assertTrue( driver .findElement(containsText("There are no Sessions"))
 .isDisplayed()); ... private By containsText(String text){
 return By.xpath("//*[contains(@text,'"+text+"')]");
 }
  27. 27. Mobile testing in the cloud
  28. 28. in the cloud
  29. 29. Firebase Test Lab
  30. 30. Upload app and instrumentation apk
  31. 31. Select devices and configurations
  32. 32. Wait for tests to complete
  33. 33. View results, including Screenshots + Video
  34. 34. Galaxy Tab 3 Nexus 7Nexus 5 Nexus 4 Lg G3
  35. 35. Select devices and configurations
  36. 36. Configure from Android Studio
  37. 37. Run from Android Studio
  38. 38. Amazon Device Farm
  39. 39. More options, including Appium
  40. 40. More devices
  41. 41. Knows a few other tricks
  42. 42. Less stable
  43. 43. On Amazon you can also manual test
  44. 44. So what should you pick? OR OR
  45. 45. Record from Android Studio
  46. 46. Firebase codelab (including Jenkins integration): https://codelabs.developers.google.com/codelabs/firebase-test-lab/index.html Testing codelab (including Espresso): https://codelabs.developers.google.com/codelabs/android-testing/#0 Codecamp App: https://play.google.com/store/apps/details?id=ro.androidiasi.codecamp.iasi.live Android Iasi: http://androidiasi.ro Android Iasi Discussion Group: http://bit.ly/android-iasi Resources
  47. 47. http://www.androidiasi.ro http://bit.ly/android-iasi

×