Slide 1

Slide 1 text

Mobile testing in the cloud Andrei Diaconu

Slide 2

Slide 2 text

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

Slide 3

Slide 3 text

1. Mobile testing 2. in the cloud

Slide 4

Slide 4 text

2 Options Simple Java Unit Tests UI tests

Slide 5

Slide 5 text

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

Slide 6

Slide 6 text

2 Options Simple Java Unit Tests UI tests Test components in isolation Super fast Simulate user interaction Slow and need Android

Slide 7

Slide 7 text

+

Slide 8

Slide 8 text

Inside man Outside man

Slide 9

Slide 9 text

Inside man Outside man • Access to code • Can change anything • Can simulate situations • Uses accessibility • Simulates a user • Can run on any app

Slide 10

Slide 10 text

Inside man Outside man

Slide 11

Slide 11 text

Inside man Outside man Instrumentation Framework UiAutomator

Slide 12

Slide 12 text

Inside man Outside man

Slide 13

Slide 13 text

How they work

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

UiAutomator AppiumDriver JUnit

Slide 16

Slide 16 text

Instrumentation Framework JUnit

Slide 17

Slide 17 text

Instrumentation Framework UiAutomator JUnit

Slide 18

Slide 18 text

Let's validate this scenario

Slide 19

Slide 19 text

onView(withText("Favorites"))
 .perform(click()); 
 onView(withId(R.id.swipe_to_refresh))
 .perform(swipeDown());
 
 onView(withText(containsString("There are no Sessions")))
 .check(matches(isDisplayed()));

Slide 20

Slide 20 text

onView(withText("Favorites"))
 .perform(click()); 
 onView(withId(R.id.swipe_to_refresh))
 .perform(swipeDown());
 
 onView(withText(containsString("There are no Sessions")))
 .check(matches(isDisplayed()));

Slide 21

Slide 21 text

onView(withText("Favorites"))
 .perform(click()); 
 onView(withId(R.id.swipe_to_refresh))
 .perform(swipeDown());
 
 onView(withText(containsString("There are no Sessions")))
 .check(matches(isDisplayed()));

Slide 22

Slide 22 text

Let's validate this scenario

Slide 23

Slide 23 text

Record from Android Studio

Slide 24

Slide 24 text

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+"')]");
 }

Slide 25

Slide 25 text

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+"')]");
 }

Slide 26

Slide 26 text

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+"')]");
 }

Slide 27

Slide 27 text

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+"')]");
 }

Slide 28

Slide 28 text

Mobile testing in the cloud

Slide 29

Slide 29 text

in the cloud

Slide 30

Slide 30 text

Firebase Test Lab

Slide 31

Slide 31 text

Upload app and instrumentation apk

Slide 32

Slide 32 text

Select devices and configurations

Slide 33

Slide 33 text

Wait for tests to complete

Slide 34

Slide 34 text

View results, including Screenshots + Video

Slide 35

Slide 35 text

Galaxy Tab 3 Nexus 7 Nexus 5 Nexus 4 Lg G3

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

Select devices and configurations

Slide 38

Slide 38 text

Configure from Android Studio

Slide 39

Slide 39 text

Run from Android Studio

Slide 40

Slide 40 text

Amazon Device Farm

Slide 41

Slide 41 text

More options, including Appium

Slide 42

Slide 42 text

More devices

Slide 43

Slide 43 text

Knows a few other tricks

Slide 44

Slide 44 text

Less stable

Slide 45

Slide 45 text

On Amazon you can also manual test

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

So what should you pick? OR OR

Slide 48

Slide 48 text

Record from Android Studio

Slide 49

Slide 49 text

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

Slide 50

Slide 50 text

http://www.androidiasi.ro http://bit.ly/android-iasi