ANDROID UI TESTING
Shauvik Roy Choudhary
PhD candidate, GeorgiaTech

shauvik@gmail.com
Team: Mattia Fazzini, Eduardo Noronha Advisor:Alessandro (Alex) Orso
TESTS
UnitTests
IntegrationTests
SystemTests FunctionalTests
Non-FunctionalTests
ANDROIDTESTINGTOOLS
Image credits: BitBar
PROBLEM
Image credits: Google, GTAC talk
doSomething()
Thread.sleep(1000)
checkSomething()
doSomething()
do{
Thread.sleep(1000)
}while(!loaded)
checkSomething()
FLAKINESS
UIThread
TestThread
Work in
Queue
click
Motion
down
Motion
up
assert
FLAKINESS
UIThread
TestThread
Work in
Queue
click
Motion
down
Motion
up
assertsleep
FLAKINESS
UIThread
TestThread
Work in Queue
click
Motion
down
Motion
up
assertsleep
TESTS
ESPRESSO: HOW IT WORKS
UIThread
TestThread
Work in
Queue
Test Case
Motion
down
Motion
up
Espresso
action assert
Blocked
IDLING RESOURCES
public interface IdlingResource {
public String getName();
public boolean isIdleNow();
public void registerIdleTransitionCallback(ResourceCallback cb);
public interface ResourceCallback {
public void onTransitionToIdle();
}
}
Espresso.registerIdlingResource(MyIdlingResource)
CHECKING INTENTS
public interface IntentSpy {
public List<ResolvedIntent> getLatestRecordedIntents();
public void record(Intent intent);
public ActivityResult getActivityResultForIntent(Intent intent);
public boolean allowIntentToProceed(Intent intent);
public void reset();
}
ESPRESSO METHODS
onView(Matcher)
.perform(ViewAction)
.check(ViewAssertion)
EXAMPLES
onView(withId(R.id.greeting))

.perform(click());
onView(withText("Hello Steve!"))

.check(matches(isDisplayed()));
Find
Do Stuff
Check
onView(Matcher<View>)
●  withId
●  withText
●  withContentDescription
●  isDisplayed
●  hasFocus
●  hasSibling
●  ...
●  mySpecialMatcher
perform(ViewAction)
●  click
●  longClick
●  doubleClick
●  typeText
●  scrollTo
●  ...
●  myCustomAction
check(ViewAssertion)
●  matches(...)
●  doesNotExist
●  myCustomAssertion
HIERARCHY
withParent(Matcher)
withChild(Matcher)
hasDescendant(Matcher)
isDescendantOfA(Matcher)
hasSibling(Matcher)
isRoot()
UI PROPERTIES
isDisplayed()
isCompletelyDisplayed()
isEnabled()
hasFocus()
isClickable()
isChecked()
isNotChecked()
withEffectiveVisibility(…)
isSelected()
ROOT MATCHERS
isFocusable()
isTouchable()
isDialog()
withDecorView(…)
isPlatformPopup()
COMMON HAMCREST
MATCHERS
allOf(Matchers)
anyOf(Matchers)
is(...)
not(...)
endsWith(String)
startsWith(String)
SEE ALSO
Preference matchers
Cursor matchers
USER PROPERTIES
withId(…)
withText(…)
withTagKey(…)
withTagValue(…)
hasContentDescription(…)
withContentDescription(…)
withHint(…)
withSpinnerText(…)
hasLinks()
hasEllipsizedText()
hasMultilineText()
INPUT
supportsInputMethods(…)
hasImeAction(…)
CLASS
isAssignableFrom(…)
withClassName(…)
Matchers
CLICK/PRESS
click()
doubleClick()
longClick()
pressBack()
pressImeActionButton()
pressKey([int/EspressoKey])
pressMenuKey()
closeSoftKeyboard()
openLink(…)
GESTURES
scrollTo()
swipeLeft()
swipeRight()
swipeUp()
swipeDown()
TEXT
clearText()
typeText(String)
typeTextIntoFocusedView(String)
replaceText(String)
POSITION ASSERTIONS
isLeftOf(Matcher)
isRightOf(Matcher)
isLeftAlignedWith(Matcher)
isRightAlignedWith(Matcher)
isAbove(Matcher)
isBelow(Matcher)
isBottomAlignedWith(Matcher)
isTopAlignedWith(Matcher)
LAYOUT ASSERTIONS
noEllipsizedText(Matcher)
noMultilineButtons()
noOverlaps([Matcher])
View Actions
matches(Matcher)
doesNotExist()
selectedDescendantsMatch(…)
View Assertions
onView(Matcher)
.perform(ViewAction)
.check(ViewAssertion)
CHEAT SHEET
2.0
https://github.com/

shauvik/espresso-examples
DEMO 1
https://github.com/
googlesamples/android-testing
DEMO 2
BARISTA
EspressoTest Generation
Tests
TEST CLOUD

More Related Content

PDF
From Manual to Automated Tests - STAC 2015
PDF
Adam carmi
PPTX
Tech Talk #5 : Android Automation Test with Espresso - Trần Văn Toàn
PDF
Oh so you test? - A guide to testing on Android from Unit to Mutation
PDF
提案:Qaも実装に踏み込んでみよう
PPTX
ISO/IEC DIS 20246 についての(ごく簡単な)説明
PDF
CheckDroid Startup Madness 2014
PDF
Test and docs: Hand in hand
From Manual to Automated Tests - STAC 2015
Adam carmi
Tech Talk #5 : Android Automation Test with Espresso - Trần Văn Toàn
Oh so you test? - A guide to testing on Android from Unit to Mutation
提案:Qaも実装に踏み込んでみよう
ISO/IEC DIS 20246 についての(ごく簡単な)説明
CheckDroid Startup Madness 2014
Test and docs: Hand in hand

Viewers also liked (10)

PDF
PhD Dissertation Defense (April 2015)
PDF
Using Robots for App Testing
PDF
Ui testing with espresso
PDF
Android Espresso
PDF
Utilizando Espresso e UIAutomator no Teste de Apps Android
PDF
Certificate Pinning in Mobile Applications
PPTX
Symbolic Execution And KLEE
PPTX
Writing and using Hamcrest Matchers
PDF
Unit testing on Android (Droidcon Dubai 2015)
PDF
Screenshots Test spoon + espresso
PhD Dissertation Defense (April 2015)
Using Robots for App Testing
Ui testing with espresso
Android Espresso
Utilizando Espresso e UIAutomator no Teste de Apps Android
Certificate Pinning in Mobile Applications
Symbolic Execution And KLEE
Writing and using Hamcrest Matchers
Unit testing on Android (Droidcon Dubai 2015)
Screenshots Test spoon + espresso
Ad

Similar to Espresso Barista (20)

PDF
Agile mobile
PDF
Agile Android
PDF
1 aleksandr gritsevski - attd example using
PPTX
Testing ASP.NET - Progressive.NET
PPTX
Eyes or heart
PDF
Gett - Mobile automation 2015
PDF
軟體測試是在測試什麼?
PPTX
PDF
Desarrollo para Android con Groovy
PDF
Testing nightwatch, by David Torroija
PPTX
Unit Testing Android Applications
PDF
6 Traits of a Successful Test Automation Architecture
PPTX
Testes instrumentais. v2
PDF
Android Threading
PPTX
Xamarin Test Cloud - from zero to hero in automated ui testing
PDF
Challenges in mobile test automation - 2011
PDF
Continuous integration using thucydides(bdd) with selenium
PPT
Testing And Drupal
PPTX
Xam expertday
PPTX
Setting UIAutomation free with Appium
Agile mobile
Agile Android
1 aleksandr gritsevski - attd example using
Testing ASP.NET - Progressive.NET
Eyes or heart
Gett - Mobile automation 2015
軟體測試是在測試什麼?
Desarrollo para Android con Groovy
Testing nightwatch, by David Torroija
Unit Testing Android Applications
6 Traits of a Successful Test Automation Architecture
Testes instrumentais. v2
Android Threading
Xamarin Test Cloud - from zero to hero in automated ui testing
Challenges in mobile test automation - 2011
Continuous integration using thucydides(bdd) with selenium
Testing And Drupal
Xam expertday
Setting UIAutomation free with Appium
Ad

Recently uploaded (20)

PDF
CloudStack 4.21: First Look Webinar slides
PDF
Consumable AI The What, Why & How for Small Teams.pdf
PDF
Credit Without Borders: AI and Financial Inclusion in Bangladesh
PDF
How IoT Sensor Integration in 2025 is Transforming Industries Worldwide
PDF
A proposed approach for plagiarism detection in Myanmar Unicode text
PPTX
Build Your First AI Agent with UiPath.pptx
PDF
Comparative analysis of machine learning models for fake news detection in so...
PDF
A review of recent deep learning applications in wood surface defect identifi...
PPTX
The various Industrial Revolutions .pptx
PPTX
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx
PDF
Flame analysis and combustion estimation using large language and vision assi...
PDF
Architecture types and enterprise applications.pdf
PDF
UiPath Agentic Automation session 1: RPA to Agents
PDF
Five Habits of High-Impact Board Members
PDF
Improvisation in detection of pomegranate leaf disease using transfer learni...
PPTX
2018-HIPAA-Renewal-Training for executives
PPT
What is a Computer? Input Devices /output devices
PPTX
Microsoft Excel 365/2024 Beginner's training
PDF
“A New Era of 3D Sensing: Transforming Industries and Creating Opportunities,...
PDF
Taming the Chaos: How to Turn Unstructured Data into Decisions
CloudStack 4.21: First Look Webinar slides
Consumable AI The What, Why & How for Small Teams.pdf
Credit Without Borders: AI and Financial Inclusion in Bangladesh
How IoT Sensor Integration in 2025 is Transforming Industries Worldwide
A proposed approach for plagiarism detection in Myanmar Unicode text
Build Your First AI Agent with UiPath.pptx
Comparative analysis of machine learning models for fake news detection in so...
A review of recent deep learning applications in wood surface defect identifi...
The various Industrial Revolutions .pptx
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx
Flame analysis and combustion estimation using large language and vision assi...
Architecture types and enterprise applications.pdf
UiPath Agentic Automation session 1: RPA to Agents
Five Habits of High-Impact Board Members
Improvisation in detection of pomegranate leaf disease using transfer learni...
2018-HIPAA-Renewal-Training for executives
What is a Computer? Input Devices /output devices
Microsoft Excel 365/2024 Beginner's training
“A New Era of 3D Sensing: Transforming Industries and Creating Opportunities,...
Taming the Chaos: How to Turn Unstructured Data into Decisions

Espresso Barista