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
Espresso 101: Introdução a UI Testing
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Pedro Salomão
January 25, 2016
Technology
52
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Espresso 101: Introdução a UI Testing
Introdução a testes de interface gráfica usando o Framework Espresso, da Google.
Pedro Salomão
January 25, 2016
More Decks by Pedro Salomão
See All by Pedro Salomão
Segurança no Desenvolvimento de App`s
ppgsalomao
1
77
Testes Unitários no Android Studio
ppgsalomao
0
130
Persistência com Realm.io
ppgsalomao
4
160
Other Decks in Technology
See All in Technology
スキルを作る、その前に!複数人で使われるスキルを 作るためのプロセス
junkifurukawa
2
300
OSC2026on_the-world-is-waiting-for-your-voice.pdf
naruoga
0
350
HacobuにおけるFDEとは/登壇資料(戸井田 裕貴)
hacobu
PRO
1
780
Datadog の学び方 - あるいは、オブザーバビリティを学ぶとは何か
mananyuki
1
440
ファミコンでPHPを動かす / PHP on the Famicom side b
tomzoh
0
130
2026-10-01_MagicPod_QAハーネスエンジニアリングとQA組織の未来像
ynisqa1988
1
530
大阪オフィスに Unitree Go2 がやってきたので Physical AI やってみた
dafujii
0
300
Snowflake Horizon Catalog と Apache Iceberg で作る オープンなデータ基盤
kitagawaz
0
440
FinTech 1-2 : Overview of FinTech
ks91
PRO
0
150
More Freedom on the Same Shared GPU Cluster: A Small Team’s Experience with vCluster
nttcom
0
130
生成AIと進める探索的データ分析(2026.10.03 第122回Tokyo.R勉強会)
tatamiya
2
1.4k
転んだ話が背中を預ける理由になる / A_story_about_falling_down_gives_you_a_reason_to_watch_each_other_s_backs.pdf
pauli
3
220
Featured
See All Featured
The untapped power of vector embeddings
frankvandijk
2
1.9k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
2
930
Accessibility Awareness
sabderemane
1
230
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
790
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.6k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
260
Leo the Paperboy
mayatellez
10
2.3k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
The Cost Of JavaScript in 2023
addyosmani
55
10k
The browser strikes back
jonoalderson
0
1.8k
Optimising Largest Contentful Paint
csswizardry
37
4k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Transcript
Espresso 101: Introdução a UI Testing Pedro Salomão @ppgsalomao
[email protected]
/
[email protected]
#whoami
Objetivos
Objetivos 1. Onde entram as diversas ferramentas de teste; 2.
O que são Testes de Interface do Usuário; 3. Como definir o que testar; 4. Como integrar o Espresso ao meu projeto; 5. Como escrever o meu primeiro teste de UI; 6. [BÔNUS] Demo.
Ferramentas para Teste
Camadas da Aplicação USUÁRIO APK INTERNET Interface Gráfica
Ferramentas para Teste Robolectric API 16+ JVM Espresso API 8+
Robotium Calabash Selendroid Instrumentation API 1+ Android Platform Appium UIAutomator API 16+ UIAutomation API 18+
Ferramentas para Teste Robolectric API 16+ JVM Espresso API 8+
Robotium Calabash Selendroid Instrumentation API 1+ Android Platform Appium UIAutomator API 16+ UIAutomation API 18+
Camadas da Aplicação USUÁRIO ESPRESSO APK INTERNET Interface Gráfica
Testes de Interface
Testes de Interface 1. O que devo testar? 2. Qual
o escopo de um teste (método)? 3. Posso testar fluxos completos? 4. E como funciona o estado da aplicação? 5. O que é um Mock e por que é importante?
None
Espresso Processo APK Test APK Espresso
Vamos falar de código?!
Integrando o Espresso
Integrando o Espresso 1. Adicionar no build.gradle, em dependencies: 2.
Adicionar no build.gradle, em android.defaultConfig: compile 'com.android.support:support-annotations:23.1.1' androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1' androidTestCompile 'com.android.support.test:runner:0.4.1' testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" fonte: https://google.github.io/android-testing-support-library/docs/espresso/setup/index.html
Escrevendo o Teste
Espresso - Asserts onView( ViewMatcher ) .perform( ViewAction ) .check(
ViewAssertion ) fonte: https://google.github.io/android-testing-support-library/docs/espresso/cheatsheet/index.html
ViewMatcher Dois usos básicos: • Encontrar uma view (onView) •
Verificar uma condição da View (matches) Exemplos: • withId( … ) • withText( … ) • isDisplayed()
ViewAction Permite executar ações na tela. Exemplos: • click() •
scrollTo( … ) • typeText( … )
ViewAssertion Permite verificar uma determinada propriedade. Exemplos: • matches( Matcher
) • doesNotExists( … ) • typeText( … ) Observação: doesNotExists() != isNotDisplayed()
Criando um teste Passos para criar um Teste usando Espresso:
• Adicionar a anotação do JUnit na classe. • Adicionar uma Rule para a Activity a ser testada. • Criar os métodos de teste.
Exemplo @RunWith(AndroidJUnit4.class) @LargeTest public class HelloWorldEspressoTest { @Rule public ActivityTestRule<MainActivity>
mActivityRule = new ActivityTestRule<>(MainActivity.class); @Test public void listGoesOverTheFold() { onView(withText("Hello world!”)) .check(matches(isDisplayed())); } }
DEMO
Links Úteis Site da Google para Android Testing https://google.github.io/android-testing-support-library/ Código
do Demo de Espresso https://github.com/ppgsalomao/espresso-examples GTAC 2014: Espresso, Spoon, Wiremock, Oh my! https://www.youtube.com/watch?v=-xQCNf_5NNM Droidcon NYC 2015 - Advanced Android Espresso https://www.youtube.com/watch?v=GlPn60-_txk
Dúvidas?
Obrigado! Pedro Salomão @ppgsalomao
[email protected]
/
[email protected]