SlideShare a Scribd company logo
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 (11)

PDF
Android UI Testing with Espresso
Gary Cheng
 
PPTX
Testing android apps with espresso
Édipo Souza
 
PDF
A Comprehensive Guide To Espresso Testing.pdf
flufftailshop
 
PDF
Visual AI Testing Using Applitools
Mikhail Laptev
 
PDF
Espresso testing
vodqancr
 
PDF
Overview the Challenges and Limitations of Android App Automation with Espres...
Sauce Labs
 
PDF
[Quality Meetup] M. Górski, M. Boś - Testy UI w Espresso z farmą w tle
Future Processing
 
PPTX
Do You Enjoy Espresso in Android App Testing?
Bitbar
 
PDF
Android UI Testing with Espresso - How to Get Started.pdf
kalichargn70th171
 
PDF
A guide to Android automated testing
jotaemepereira
 
PPTX
UI Testing for Your Xamarin.Forms Apps
Codrina Merigo
 
Android UI Testing with Espresso
Gary Cheng
 
Testing android apps with espresso
Édipo Souza
 
A Comprehensive Guide To Espresso Testing.pdf
flufftailshop
 
Visual AI Testing Using Applitools
Mikhail Laptev
 
Espresso testing
vodqancr
 
Overview the Challenges and Limitations of Android App Automation with Espres...
Sauce Labs
 
[Quality Meetup] M. Górski, M. Boś - Testy UI w Espresso z farmą w tle
Future Processing
 
Do You Enjoy Espresso in Android App Testing?
Bitbar
 
Android UI Testing with Espresso - How to Get Started.pdf
kalichargn70th171
 
A guide to Android automated testing
jotaemepereira
 
UI Testing for Your Xamarin.Forms Apps
Codrina Merigo
 

More from Annyce Davis (17)

PDF
Getting a Grip on GraphQL
Annyce Davis
 
PDF
RxJava In Baby Steps
Annyce Davis
 
PDF
No internet? No Problem!
Annyce Davis
 
PDF
First Do No Harm - 360|AnDev
Annyce Davis
 
PDF
First Do No Harm - Droidcon Boston
Annyce Davis
 
PDF
Creating Gradle Plugins - Oredev
Annyce Davis
 
PDF
Developing Apps for Emerging Markets
Annyce Davis
 
PDF
Develop Maintainable Apps - edUiConf
Annyce Davis
 
PDF
From Grails to Android: A Simple Journey
Annyce Davis
 
PDF
Google I/O 2016 Recap
Annyce Davis
 
PDF
Say It With Video
Annyce Davis
 
PDF
Creating Gradle Plugins
Annyce Davis
 
PDF
Static Code Analysis
Annyce Davis
 
PDF
Develop Maintainable Apps
Annyce Davis
 
PDF
Android Testing, Why So Hard?!
Annyce Davis
 
PDF
Measuring Audience Engagement through Analytics
Annyce Davis
 
PDF
DC Media Innovations Kick-Off Meetup
Annyce Davis
 
Getting a Grip on GraphQL
Annyce Davis
 
RxJava In Baby Steps
Annyce Davis
 
No internet? No Problem!
Annyce Davis
 
First Do No Harm - 360|AnDev
Annyce Davis
 
First Do No Harm - Droidcon Boston
Annyce Davis
 
Creating Gradle Plugins - Oredev
Annyce Davis
 
Developing Apps for Emerging Markets
Annyce Davis
 
Develop Maintainable Apps - edUiConf
Annyce Davis
 
From Grails to Android: A Simple Journey
Annyce Davis
 
Google I/O 2016 Recap
Annyce Davis
 
Say It With Video
Annyce Davis
 
Creating Gradle Plugins
Annyce Davis
 
Static Code Analysis
Annyce Davis
 
Develop Maintainable Apps
Annyce Davis
 
Android Testing, Why So Hard?!
Annyce Davis
 
Measuring Audience Engagement through Analytics
Annyce Davis
 
DC Media Innovations Kick-Off Meetup
Annyce Davis
 
Ad

Screen Robots: UI Tests in Espresso