Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
A good Barista to enjoy a good Espresso
Search
RubenAbad
October 16, 2018
Programming
41
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
A good Barista to enjoy a good Espresso
RubenAbad
October 16, 2018
Other Decks in Programming
See All in Programming
ジョジョの世界をXRで再現する
mofurune
0
160
Vue Fes Japan の “作る側”に関わってみて
naokihaba
0
160
Next.js: The final boss of Web Performance
guaca
0
250
當我們開始不讀 Code - AI Agent 時代,Code Review 與 Clean Code 還剩下什麼?
jame2408
1
200
AWS CDKのカスタムリソースでContinuum(旧Security Agent)を実装した話 | Implementing Continuum (formerly Security Agent) via AWS CDK Custom Resource
akihisaikeda
2
150
自サークルのIdPからログアウトできるようになるまで
taiseiue
1
140
iOS 27でニュースアプリはどう変わる!? 〜日経電子版の新機能対応と、開発事例から〜
lynnswap
7
13k
Railsのためのパスキー実践入門 〜マルチテナントSaaSでの意思決定〜
utakaha
2
550
golang-bob.pdf
iwatsukayura
0
130
AWSに止められる覚悟してますか?
morizo_1984
2
530
Domain-Driven Transformation
hschwentner
2
2.3k
作れる、でも消せるか?──安全に「枯らして消す」機能削除術 / Drain, Then Delete
chobishiba
2
640
Featured
See All Featured
For a Future-Friendly Web
brad_frost
184
10k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
480
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
750
Discover your Explorer Soul
emna__ayadi
2
1.3k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1.1k
A Tale of Four Properties
chriscoyier
163
24k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
370
WENDY [Excerpt]
tessaabrams
14
40k
sira's awesome portfolio website redesign presentation
elsirapls
0
450
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
The Pragmatic Product Professional
lauravandoore
37
7.5k
Transcript
Android Kaizen Talks Introducing Barista library
“The person who serves a great Espresso”
Espresso onView(withId(R.id.button)).perform(click()) Barista clickOn(R.id.button)
Interactions with Barista
clickOn(R.id.viewId) clickOn(R.string.some_text) clickOn(“Some text”) clickBack()
longClickOn(R.id.viewId) longClickOn(R.string.some_text) longClickOn(“Some text”) Long click?
writeTo(R.id.editTextId, “Cooooool stuff!”) clearText(R.id.editTextId)
Are you having troubles to test ListViews / RecyclerViews?
clickListItem(R.id.recyclerViewId, itemPosition) clickListItemChild( R.id.recyclerViewId, itemPosition, R.id.clickableViewId ) scrollListToPosition(R.id.recyclerViewId, itemPosition)
And more, and more useful functions… clickMenu(R.id.menuItemId) clickSpinnerItem(R.id.spinnerId, 2) openDrawer()
refresh() closeKeyboard() swipeViewPagerForward() …
Assertions with Barista
Espresso onView(withId(R.id.button)).check(isDisplayed()) Barista assertDisplayed(R.id.button)
assertDisplayed(R.id.buttonId) assertDisplayed(R.string.textId) assertDisplayed(“Displayed!”) assertDisplayed(R.id.buttonId, “Displayed!”)
assertDisplayed assertNotDisplayed assertEnabled assertDisabled assertNotExist assertChecked assertUnchecked assertHasAnyDrawable assertHasDrawable assertHasAnyBackground
assertDrawerIsOpen assertDrawerIsClosed assertContains assertNotContains
Need more goodies?
Custom assertions
assertAny<Button>( ) { it.enabled == true } R.id.buttonId “Button text”
Need more goodies?
mockAndroidCamera() // Creates a Bitmap on a camera provided URI
Need more goodies?
PermissionGranter.allowPermissionsIfNeeded( Manifest.permission.GET_ACCOUNTS )
Need more goodies?
PermissionGranter.allowPermissionsIfNeeded( Manifest.permission.GET_ACCOUNTS )
Need more goodies?
@get:Rule val clearPreferenceRule = ClearPreferenceRule() // Clear all app’s SharedPreferences
@get:Rule val clearDatabaseRule = ClearDatabaseRule() // Delete all tables from all the app’s SQLite Databases @get:Rule val clearFilesRule = ClearFilesRule() // Delete all files in getFilesDir() and getCacheDir()
Need more goodies?
@Test @AllowFlaky(attempts = 5) fun myTest() { … } @Test
@Repeat(times = 5) fun myTest() { … }
Can it be even simpler by default?
@get:Rule val baristaRule = BaristaRule.create(MyActivity::class.java) baristaRule.launchActivity() //…
The rule assumes some sane defaults: - Retry flaky tests:
10 attempts - Launch activity automatically: false - Initial touch mode enabled: true - Clear preferences - Clear databases - Clear files
“Magic” that Barista does for you
- Scrolls when needed - Scrolls on all views, including
NestedScrollViews - Just interacts with displayed Views
Any question?
You can find everything you need at their Github! https://github.com/SchibstedSpain/Barista