SlideShare a Scribd company logo
1 of 26
Download to read offline
Screen Robots
@brwngrldev
UI Tests in Espresso
1. User Interface Testing
2. Espresso
3. Screen Robots
Agenda
@brwngrldev
UI Testing
@brwngrldev
UI element
UI Testing
@brwngrldev
UI Testing
@brwngrldev
Espresso
• Framework
• View Matchers
• View Assertions
• View Actions
@brwngrldev
Usage
@brwngrldev
Usage
@brwngrldev
Usage
@brwngrldev
@Test
public void shouldProceedWithLoginWhenValid () {
onView( withId( R.id.login_username_entry ) )
.perform( typeText( TEST_EMAIL ) );
onView( withId( R.id.login_password_entry ) )
.perform( typeText( TEST_PASSWORD ) );
onView( withId( R.id.login_button ) )
.perform( click() );
intended( hasComponent( hasShortClassName( PACKAGE_NAME ) ) );
}
@brwngrldev
@Test
public void shouldProceedWithLoginWhenValid () {
onView( withId( … ) )
.perform( typeText( … ) );
onView( withId( … ) )
.perform( typeText( … ) );
onView( withId( … ) )
.perform( click() );
…
}
@brwngrldev
@Test
public void shouldProceedWithLoginWhenValid () {
< let’s do better />
}
@brwngrldev
@brwngrldev
@Test
public void shouldProceedWithLoginWhenValid () {
}
@brwngrldev
@Test
public void shouldProceedWithLoginWhenValid () {
withRobot( LoginScreenRobot.class )
}
@brwngrldev
@Test
public void shouldProceedWithLoginWhenValid () {
withRobot( LoginScreenRobot.class )
.callLogin( TEST_EMAIL, TEST_PASSWORD )
}
@brwngrldev
@Test
public void shouldProceedWithLoginWhenValid () {
withRobot( LoginScreenRobot.class )
.callLogin( TEST_EMAIL, TEST_PASSWORD )
.checkIsLoggedIn();
}
@brwngrldev
@brwngrldev
Just 3 lines
of code!
public LoginScreenRobot callLogin (String username, String password)
{
}
@brwngrldev
Screen Robot
public LoginScreenRobot callLogin (String username, String password)
{
return enterTextIntoView ( R.id.login_username_entry, username )
}
@brwngrldev
Screen Robot
public LoginScreenRobot callLogin (String username, String password)
{
return enterTextIntoView ( R.id.login_username_entry, username )
.enterTextIntoView ( R.id.login_password_entry, password )
}
@brwngrldev
Screen Robot
public LoginScreenRobot callLogin (String username, String password)
{
return enterTextIntoView ( R.id.login_username_entry, username )
.enterTextIntoView ( R.id.login_password_entry, password )
.clickOkOnView( R.id.login_button );
}
@brwngrldev
Screen Robot
@brwngrldev
@brwngrldev
Test Scenarios
• Login with valid credentials
• Login with invalid credentials
• Login with bad server response
• Changing the slide language
• Verifying the correctness of the slide content
• Entering content into a text slide
Summary
Screen Robots
User Interface Testing
Espresso
@brwngrldev
Thanks!
@brwngrldev
+AnnyceDavis
www.adavis.info

More Related Content

Similar to Screen Robots: UI Tests in Espresso

Android the Agile way
Android the Agile wayAndroid the Agile way
Android the Agile wayAshwin Raghav
 
Testes instrumentais. v2
Testes instrumentais. v2Testes instrumentais. v2
Testes instrumentais. v2AlexSoares91
 
Testing android apps with espresso
Testing android apps with espressoTesting android apps with espresso
Testing android apps with espressoÉdipo Souza
 
Protractor Tutorial Quality in Agile 2015
Protractor Tutorial Quality in Agile 2015Protractor Tutorial Quality in Agile 2015
Protractor Tutorial Quality in Agile 2015Andrew Eisenberg
 
Pragmatic UI testing with Compose Semantics.pdf
Pragmatic UI testing with Compose Semantics.pdfPragmatic UI testing with Compose Semantics.pdf
Pragmatic UI testing with Compose Semantics.pdfinfogdgmi
 
Automated ui testing
Automated ui testingAutomated ui testing
Automated ui testingDavidReidy
 
jQuery Bay Area Conference 2010
jQuery Bay Area Conference 2010jQuery Bay Area Conference 2010
jQuery Bay Area Conference 2010mennovanslooten
 
Android UI Testing with Espresso
Android UI Testing with EspressoAndroid UI Testing with Espresso
Android UI Testing with EspressoGary Cheng
 
[Quality Meetup] M. Górski, M. Boś - Testy UI w Espresso z farmą w tle
[Quality Meetup] M. Górski, M. Boś - Testy UI w Espresso z farmą w tle[Quality Meetup] M. Górski, M. Boś - Testy UI w Espresso z farmą w tle
[Quality Meetup] M. Górski, M. Boś - Testy UI w Espresso z farmą w tleFuture Processing
 
Android Testing
Android TestingAndroid Testing
Android TestingEvan Lin
 
Dev fest kyoto_2021-flutter_test
Dev fest kyoto_2021-flutter_testDev fest kyoto_2021-flutter_test
Dev fest kyoto_2021-flutter_testMasanori Kato
 
Testable JavaScript: Application Architecture
Testable JavaScript:  Application ArchitectureTestable JavaScript:  Application Architecture
Testable JavaScript: Application ArchitectureMark Trostler
 
Mobile developer is Software developer
Mobile developer is Software developerMobile developer is Software developer
Mobile developer is Software developerEugen Martynov
 
Hitchhiker's guide to Functional Testing
Hitchhiker's guide to Functional TestingHitchhiker's guide to Functional Testing
Hitchhiker's guide to Functional TestingWiebe Elsinga
 
Top100summit 谷歌-scott-improve your automated web application testing
Top100summit  谷歌-scott-improve your automated web application testingTop100summit  谷歌-scott-improve your automated web application testing
Top100summit 谷歌-scott-improve your automated web application testingdrewz lin
 
Android testing calabash
Android testing calabashAndroid testing calabash
Android testing calabashkellinreaver
 
Functional Testing for React Native Apps
Functional Testing for React Native AppsFunctional Testing for React Native Apps
Functional Testing for React Native AppsK. Matthew Dupree
 

Similar to Screen Robots: UI Tests in Espresso (20)

Android the Agile way
Android the Agile wayAndroid the Agile way
Android the Agile way
 
Testes instrumentais. v2
Testes instrumentais. v2Testes instrumentais. v2
Testes instrumentais. v2
 
Testing android apps with espresso
Testing android apps with espressoTesting android apps with espresso
Testing android apps with espresso
 
Protractor Tutorial Quality in Agile 2015
Protractor Tutorial Quality in Agile 2015Protractor Tutorial Quality in Agile 2015
Protractor Tutorial Quality in Agile 2015
 
Pragmatic UI testing with Compose Semantics.pdf
Pragmatic UI testing with Compose Semantics.pdfPragmatic UI testing with Compose Semantics.pdf
Pragmatic UI testing with Compose Semantics.pdf
 
Automated ui testing
Automated ui testingAutomated ui testing
Automated ui testing
 
Xam expertday
Xam expertdayXam expertday
Xam expertday
 
jQuery Bay Area Conference 2010
jQuery Bay Area Conference 2010jQuery Bay Area Conference 2010
jQuery Bay Area Conference 2010
 
Android UI Testing with Espresso
Android UI Testing with EspressoAndroid UI Testing with Espresso
Android UI Testing with Espresso
 
@Anywhere
@Anywhere@Anywhere
@Anywhere
 
[Quality Meetup] M. Górski, M. Boś - Testy UI w Espresso z farmą w tle
[Quality Meetup] M. Górski, M. Boś - Testy UI w Espresso z farmą w tle[Quality Meetup] M. Górski, M. Boś - Testy UI w Espresso z farmą w tle
[Quality Meetup] M. Górski, M. Boś - Testy UI w Espresso z farmą w tle
 
Android Testing
Android TestingAndroid Testing
Android Testing
 
Dev fest kyoto_2021-flutter_test
Dev fest kyoto_2021-flutter_testDev fest kyoto_2021-flutter_test
Dev fest kyoto_2021-flutter_test
 
Test automation
Test  automationTest  automation
Test automation
 
Testable JavaScript: Application Architecture
Testable JavaScript:  Application ArchitectureTestable JavaScript:  Application Architecture
Testable JavaScript: Application Architecture
 
Mobile developer is Software developer
Mobile developer is Software developerMobile developer is Software developer
Mobile developer is Software developer
 
Hitchhiker's guide to Functional Testing
Hitchhiker's guide to Functional TestingHitchhiker's guide to Functional Testing
Hitchhiker's guide to Functional Testing
 
Top100summit 谷歌-scott-improve your automated web application testing
Top100summit  谷歌-scott-improve your automated web application testingTop100summit  谷歌-scott-improve your automated web application testing
Top100summit 谷歌-scott-improve your automated web application testing
 
Android testing calabash
Android testing calabashAndroid testing calabash
Android testing calabash
 
Functional Testing for React Native Apps
Functional Testing for React Native AppsFunctional Testing for React Native Apps
Functional Testing for React Native Apps
 

More from Annyce Davis

Getting a Grip on GraphQL
Getting a Grip on GraphQLGetting a Grip on GraphQL
Getting a Grip on GraphQLAnnyce Davis
 
RxJava In Baby Steps
RxJava In Baby StepsRxJava In Baby Steps
RxJava In Baby StepsAnnyce Davis
 
No internet? No Problem!
No internet? No Problem!No internet? No Problem!
No internet? No Problem!Annyce Davis
 
First Do No Harm - 360|AnDev
First Do No Harm - 360|AnDevFirst Do No Harm - 360|AnDev
First Do No Harm - 360|AnDevAnnyce Davis
 
First Do No Harm - Droidcon Boston
First Do No Harm - Droidcon BostonFirst Do No Harm - Droidcon Boston
First Do No Harm - Droidcon BostonAnnyce Davis
 
Creating Gradle Plugins - Oredev
Creating Gradle Plugins - OredevCreating Gradle Plugins - Oredev
Creating Gradle Plugins - OredevAnnyce Davis
 
Developing Apps for Emerging Markets
Developing Apps for Emerging MarketsDeveloping Apps for Emerging Markets
Developing Apps for Emerging MarketsAnnyce Davis
 
Develop Maintainable Apps - edUiConf
Develop Maintainable Apps - edUiConfDevelop Maintainable Apps - edUiConf
Develop Maintainable Apps - edUiConfAnnyce Davis
 
From Grails to Android: A Simple Journey
From Grails to Android: A Simple JourneyFrom Grails to Android: A Simple Journey
From Grails to Android: A Simple JourneyAnnyce Davis
 
Google I/O 2016 Recap
Google I/O 2016 RecapGoogle I/O 2016 Recap
Google I/O 2016 RecapAnnyce Davis
 
Creating Gradle Plugins
Creating Gradle PluginsCreating Gradle Plugins
Creating Gradle PluginsAnnyce Davis
 
Static Code Analysis
Static Code AnalysisStatic Code Analysis
Static Code AnalysisAnnyce Davis
 
Develop Maintainable Apps
Develop Maintainable AppsDevelop Maintainable Apps
Develop Maintainable AppsAnnyce Davis
 
Android Testing, Why So Hard?!
Android Testing, Why So Hard?!Android Testing, Why So Hard?!
Android Testing, Why So Hard?!Annyce Davis
 
Measuring Audience Engagement through Analytics
Measuring Audience Engagement through AnalyticsMeasuring Audience Engagement through Analytics
Measuring Audience Engagement through AnalyticsAnnyce Davis
 
DC Media Innovations Kick-Off Meetup
DC Media Innovations Kick-Off MeetupDC Media Innovations Kick-Off Meetup
DC Media Innovations Kick-Off MeetupAnnyce Davis
 

More from Annyce Davis (17)

Getting a Grip on GraphQL
Getting a Grip on GraphQLGetting a Grip on GraphQL
Getting a Grip on GraphQL
 
RxJava In Baby Steps
RxJava In Baby StepsRxJava In Baby Steps
RxJava In Baby Steps
 
No internet? No Problem!
No internet? No Problem!No internet? No Problem!
No internet? No Problem!
 
First Do No Harm - 360|AnDev
First Do No Harm - 360|AnDevFirst Do No Harm - 360|AnDev
First Do No Harm - 360|AnDev
 
First Do No Harm - Droidcon Boston
First Do No Harm - Droidcon BostonFirst Do No Harm - Droidcon Boston
First Do No Harm - Droidcon Boston
 
Creating Gradle Plugins - Oredev
Creating Gradle Plugins - OredevCreating Gradle Plugins - Oredev
Creating Gradle Plugins - Oredev
 
Developing Apps for Emerging Markets
Developing Apps for Emerging MarketsDeveloping Apps for Emerging Markets
Developing Apps for Emerging Markets
 
Develop Maintainable Apps - edUiConf
Develop Maintainable Apps - edUiConfDevelop Maintainable Apps - edUiConf
Develop Maintainable Apps - edUiConf
 
From Grails to Android: A Simple Journey
From Grails to Android: A Simple JourneyFrom Grails to Android: A Simple Journey
From Grails to Android: A Simple Journey
 
Google I/O 2016 Recap
Google I/O 2016 RecapGoogle I/O 2016 Recap
Google I/O 2016 Recap
 
Say It With Video
Say It With VideoSay It With Video
Say It With Video
 
Creating Gradle Plugins
Creating Gradle PluginsCreating Gradle Plugins
Creating Gradle Plugins
 
Static Code Analysis
Static Code AnalysisStatic Code Analysis
Static Code Analysis
 
Develop Maintainable Apps
Develop Maintainable AppsDevelop Maintainable Apps
Develop Maintainable Apps
 
Android Testing, Why So Hard?!
Android Testing, Why So Hard?!Android Testing, Why So Hard?!
Android Testing, Why So Hard?!
 
Measuring Audience Engagement through Analytics
Measuring Audience Engagement through AnalyticsMeasuring Audience Engagement through Analytics
Measuring Audience Engagement through Analytics
 
DC Media Innovations Kick-Off Meetup
DC Media Innovations Kick-Off MeetupDC Media Innovations Kick-Off Meetup
DC Media Innovations Kick-Off Meetup
 

Recently uploaded

Thane 💋 Call Girls 7738631006 💋 Call Girls in Thane Escort service book now. ...
Thane 💋 Call Girls 7738631006 💋 Call Girls in Thane Escort service book now. ...Thane 💋 Call Girls 7738631006 💋 Call Girls in Thane Escort service book now. ...
Thane 💋 Call Girls 7738631006 💋 Call Girls in Thane Escort service book now. ...Pooja Nehwal
 
Leading Mobile App Development Companies in India (2).pdf
Leading Mobile App Development Companies in India (2).pdfLeading Mobile App Development Companies in India (2).pdf
Leading Mobile App Development Companies in India (2).pdfCWS Technology
 
9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service
9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service
9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Servicenishacall1
 
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCRFULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCRnishacall1
 
Android Application Components with Implementation & Examples
Android Application Components with Implementation & ExamplesAndroid Application Components with Implementation & Examples
Android Application Components with Implementation & ExamplesChandrakantDivate1
 
Mobile Application Development-Android and It’s Tools
Mobile Application Development-Android and It’s ToolsMobile Application Development-Android and It’s Tools
Mobile Application Development-Android and It’s ToolsChandrakantDivate1
 
Mobile Application Development-Components and Layouts
Mobile Application Development-Components and LayoutsMobile Application Development-Components and Layouts
Mobile Application Development-Components and LayoutsChandrakantDivate1
 

Recently uploaded (8)

Thane 💋 Call Girls 7738631006 💋 Call Girls in Thane Escort service book now. ...
Thane 💋 Call Girls 7738631006 💋 Call Girls in Thane Escort service book now. ...Thane 💋 Call Girls 7738631006 💋 Call Girls in Thane Escort service book now. ...
Thane 💋 Call Girls 7738631006 💋 Call Girls in Thane Escort service book now. ...
 
Leading Mobile App Development Companies in India (2).pdf
Leading Mobile App Development Companies in India (2).pdfLeading Mobile App Development Companies in India (2).pdf
Leading Mobile App Development Companies in India (2).pdf
 
9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service
9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service
9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service
 
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCRFULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
 
Android Application Components with Implementation & Examples
Android Application Components with Implementation & ExamplesAndroid Application Components with Implementation & Examples
Android Application Components with Implementation & Examples
 
Mobile Application Development-Android and It’s Tools
Mobile Application Development-Android and It’s ToolsMobile Application Development-Android and It’s Tools
Mobile Application Development-Android and It’s Tools
 
Mobile Application Development-Components and Layouts
Mobile Application Development-Components and LayoutsMobile Application Development-Components and Layouts
Mobile Application Development-Components and Layouts
 
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
 

Screen Robots: UI Tests in Espresso