Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Mobile Testing in the cloud

Mobile Testing in the cloud

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.

Presented at:
- Codecamp Iasi Autumn 2016
- MBLTdev Moscow 2016
- Codecamp Cluj Autumn 2016
- DevFest Romania 2016

3d14b1dcd13755bcbafc5ac9c9ab1426?s=128

Andrei Diaconu

November 25, 2016
Tweet

Transcript

  1. Mobile testing in the cloud Andrei Diaconu

  2. http://www.andreidiaconu.com http://www.androidiasi.ro Andrei Diaconu Android Iasi Me

  3. 1. Mobile testing 2. in the cloud

  4. 2 Options Simple Java Unit Tests UI tests

  5. 2 Options Simple Java Unit Tests UI tests Test components

    in isolation Super fast
  6. 2 Options Simple Java Unit Tests UI tests Test components

    in isolation Super fast Simulate user interaction Slow and need Android
  7. +

  8. Inside man Outside man

  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. Inside man Outside man

  11. Inside man Outside man Instrumentation Framework UiAutomator

  12. Inside man Outside man

  13. How they work

  14. None
  15. UiAutomator AppiumDriver JUnit

  16. Instrumentation Framework JUnit

  17. Instrumentation Framework UiAutomator JUnit

  18. Let's validate this scenario

  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. 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. onView(withText("Favorites"))
 .perform(click()); 
 onView(withId(R.id.swipe_to_refresh))
 .perform(swipeDown());
 
 onView(withText(containsString("There are no Sessions")))


    .check(matches(isDisplayed()));
  22. Let's validate this scenario

  23. Record from Android Studio

  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. 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. 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. 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+"')]");
 }
  28. Mobile testing in the cloud

  29. in the cloud

  30. Firebase Test Lab

  31. Upload app and instrumentation apk

  32. Select devices and configurations

  33. Wait for tests to complete

  34. View results, including Screenshots + Video

  35. Galaxy Tab 3 Nexus 7 Nexus 5 Nexus 4 Lg

    G3
  36. None
  37. Select devices and configurations

  38. Configure from Android Studio

  39. Run from Android Studio

  40. Amazon Device Farm

  41. More options, including Appium

  42. More devices

  43. Knows a few other tricks

  44. Less stable

  45. On Amazon you can also manual test

  46. None
  47. So what should you pick? OR OR

  48. Record from Android Studio

  49. 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
  50. http://www.androidiasi.ro http://bit.ly/android-iasi