SlideShare a Scribd company logo
Overcome the Challenges and Limitations of
Android App Automation with Espresso
Myself Jagmit Singh is a Senior Automation
Engineer at CBC Digital Labs, responsible for UI
Automation of Listen Apps
What is CBC?
Canadian Broadcasting Corporation branded as CBC/Radio Canada
is National Public Broadcaster for TV and Radio
Agenda
● What’s Espresso?
● Challenges in Android UI Automation
● Why Use Expresso?
● Writing Espresso Tests
● Espresso & TestButler
● Espresso & UIAutomator
● Continuous UI Testing using Espresso and Jenkins
What’s Espresso?
● A testing framework for Android to write reliable UI tests
● Developed internally by Google
● Run on devices running Android 2.2 and higher
● Instrumentation-based API works with AndroidJUnitRunner
Challenges in Android UI Automation.
● Tests are Flaky!
● Tests are Slow!
● Scaling Automation Scope - Testing Outside the App
● Some Difficulty in locating UI elements!
Why Use Espresso?
● Fast and Reliable
● Support testing activities outside the App
● Espresso tests are developed within the App
● Native Platform Developed by Google -- Always ahead of the curve
Writing Espresso Tests
Setup Espresso with Gradle
Add Dependencies to build.gradle
android {
defaultConfig {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
}
dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
androidTestImplementation 'com.linkedin.testbutler:test-butler-library:1.4.0'
}
Android Test Rules
● Make Use of JUnit @Rule Annotations
● Retry Rule
@Rule
public final RetryRule retry = new RetryRule();
● Activity Test Rule
The Activity under the Rule will be launched again in each Test
@Rule
public ActivityTestRule activityRule = new ActivityTestRule<>(MyActivity.class);
Sample Espresso Test
Overview the Challenges and Limitations of Android App Automation with Espresso by Jagmit Singh
Espresso & Test Butler
How TestButler Works?
❖ Two Part Project: App and Library
❖ Espresso Tests depends on Library
❖ Install TestButler App on Emulator prior to running Tests
❖ TestButler App have permissions to change Device Settings
Espresso & Test Butler
❖ Controlling the environment with Espresso Tests
❖ Disable crash & App Not Responding (ANR) dialogs
❖ Turn Wifi ON/OFF
❖ Change Locale
❖ Set Screen Orientation
❖ Disable Animations - Espresso Tests Run Reliably
Overview the Challenges and Limitations of Android App Automation with Espresso by Jagmit Singh
Espresso & UI Automator
Espresso & UI Automator
Espresso allow to test many things inside your application in simple way
UiAutomator allows test to access many system stuff, e.g. notification, another
applications, contacts, dialer, etc.
Overview the Challenges and Limitations of Android App Automation with Espresso by Jagmit Singh
Continuous UI Testing and Deployment with
Espresso and Jenkins
Execution at Firebase
Espresso Tests
Selected builds pushed to Fabric for Testing
Overview the Challenges and Limitations of Android App Automation with Espresso by Jagmit Singh

More Related Content

PPTX
TDD - Agile
PPTX
Android testing
PPT
PPTX
Android studio ppt
PPTX
Dart ppt
PPTX
Cypress for Testing
PPTX
Introduction to kotlin
PPTX
Kotlin Basics & Introduction to Jetpack Compose.pptx
TDD - Agile
Android testing
Android studio ppt
Dart ppt
Cypress for Testing
Introduction to kotlin
Kotlin Basics & Introduction to Jetpack Compose.pptx

What's hot (20)

PPTX
Jetpack Compose.pptx
PDF
A quick and fast intro to Kotlin
PPTX
Testing android apps with espresso
PPTX
Automation Testing with Test Complete
PPT
Introduction to Eclipse IDE
PPTX
Unit Testing Android Applications
PPTX
Coroutines in Kotlin
PDF
Jetpack Compose a new way to implement UI on Android
PDF
Jetpack Compose - A Lightning Tour
PPTX
Android Programming Seminar
PPTX
Introduction to Koltin for Android Part I
PDF
Core JAVA Notes
PDF
코드의 품질 (Code Quality)
PPTX
Android Studio Overview
PDF
Android UI Testing with Espresso
PPTX
Visual studio
PPTX
Understanding Unit Testing
PPTX
Introduction to Flutter
PDF
What is flutter and why should i care?
PDF
ScalaUA - distage: Staged Dependency Injection
Jetpack Compose.pptx
A quick and fast intro to Kotlin
Testing android apps with espresso
Automation Testing with Test Complete
Introduction to Eclipse IDE
Unit Testing Android Applications
Coroutines in Kotlin
Jetpack Compose a new way to implement UI on Android
Jetpack Compose - A Lightning Tour
Android Programming Seminar
Introduction to Koltin for Android Part I
Core JAVA Notes
코드의 품질 (Code Quality)
Android Studio Overview
Android UI Testing with Espresso
Visual studio
Understanding Unit Testing
Introduction to Flutter
What is flutter and why should i care?
ScalaUA - distage: Staged Dependency Injection
Ad

Similar to Overview the Challenges and Limitations of Android App Automation with Espresso by Jagmit Singh (20)

ODP
PPTX
Testing Android Application, Droidcon Torino
PDF
How to Test Android and iOS Mobile Apps with Appium.pdf
PDF
A Comprehensive Guide To Espresso Testing.pdf
PDF
Espresso
PPTX
Dive into Angular, part 5: Experience
PDF
Play with Testing on Android - Gilang Ramadhan (Academy Content Writer at Dic...
PPT
mohit anand
PDF
A Comprehensive Guide to Conducting Test Automation Using Appium & Cucumber o...
PDF
Appium Automation Testing Tutorial PDF: Learn Mobile Testing in 7 Days
PPTX
Automation Proposal_V1.0
PPTX
Mobile Automation with Appium
PDF
Best Mobile Test Automation Solutions: Beyond Appium
PDF
[@NaukriEngineering] Mobile Web app scripts execution using Appium
PDF
Top 4 Popular Android Test Automation Frameworks During an Economic Downturn.pdf
PDF
Functional Testing - A Detailed Guide.pdf
PDF
Use Jenkins For Continuous Load Testing And Mobile Test Automation
PDF
Kickstart Your QA: An Introduction to Automated Regression Testing Tools
PDF
Testing Angular apps_ A complete guide for developers.pdf
PPTX
Speed upyourtest with_appium
Testing Android Application, Droidcon Torino
How to Test Android and iOS Mobile Apps with Appium.pdf
A Comprehensive Guide To Espresso Testing.pdf
Espresso
Dive into Angular, part 5: Experience
Play with Testing on Android - Gilang Ramadhan (Academy Content Writer at Dic...
mohit anand
A Comprehensive Guide to Conducting Test Automation Using Appium & Cucumber o...
Appium Automation Testing Tutorial PDF: Learn Mobile Testing in 7 Days
Automation Proposal_V1.0
Mobile Automation with Appium
Best Mobile Test Automation Solutions: Beyond Appium
[@NaukriEngineering] Mobile Web app scripts execution using Appium
Top 4 Popular Android Test Automation Frameworks During an Economic Downturn.pdf
Functional Testing - A Detailed Guide.pdf
Use Jenkins For Continuous Load Testing And Mobile Test Automation
Kickstart Your QA: An Introduction to Automated Regression Testing Tools
Testing Angular apps_ A complete guide for developers.pdf
Speed upyourtest with_appium
Ad

More from Sauce Labs (20)

PDF
Simplify Salesforce Testing with AI-Driven Codeless Tools
PDF
Testing on Mobile Devices with Location Services
PDF
Your Framework for Success: introduction to JavaScript Testing at Scale
PDF
Automating Hybrid Applications with Appium
PDF
Quality at Speed: More API Testing, Less UI Testing
PPTX
Creating Digital Confidence with Test Automation
PDF
Just Enough (Automated) Testing
PDF
Using Axe to Add Accessibility Checks to Your Existing Selenium Tests
PDF
How Open Source Helps to Bring Back Product Obsession
PDF
Webinar: A Sneak Peek at Selenium 4 with Simon Stewart
PDF
[Deu] Test Automatisierung Mit Web Driver.io
PDF
Accelerating Innovation: Leveraging Open Source to Optimize Your Shift-Left I...
PDF
Accelerating Your Digital Agenda with Continuous Testing ft. Forrester
PDF
How to Measure Success in Continuous Testing
PDF
From Zero to 2.7 Million - How Verizon Media Embraced Open Source to Accelera...
PDF
5 Steps to Jump Start Your Test Automation
PDF
Sauce Labs Webinar: Rising Importance of Software Testing
PDF
BDD With Selenide by Hima Bindu Peteti
PDF
Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P...
PDF
Continuous Delivery for "Mature" Codebases by Melisa Benua
Simplify Salesforce Testing with AI-Driven Codeless Tools
Testing on Mobile Devices with Location Services
Your Framework for Success: introduction to JavaScript Testing at Scale
Automating Hybrid Applications with Appium
Quality at Speed: More API Testing, Less UI Testing
Creating Digital Confidence with Test Automation
Just Enough (Automated) Testing
Using Axe to Add Accessibility Checks to Your Existing Selenium Tests
How Open Source Helps to Bring Back Product Obsession
Webinar: A Sneak Peek at Selenium 4 with Simon Stewart
[Deu] Test Automatisierung Mit Web Driver.io
Accelerating Innovation: Leveraging Open Source to Optimize Your Shift-Left I...
Accelerating Your Digital Agenda with Continuous Testing ft. Forrester
How to Measure Success in Continuous Testing
From Zero to 2.7 Million - How Verizon Media Embraced Open Source to Accelera...
5 Steps to Jump Start Your Test Automation
Sauce Labs Webinar: Rising Importance of Software Testing
BDD With Selenide by Hima Bindu Peteti
Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P...
Continuous Delivery for "Mature" Codebases by Melisa Benua

Recently uploaded (20)

PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPTX
ISO 45001 Occupational Health and Safety Management System
DOCX
The Five Best AI Cover Tools in 2025.docx
PDF
top salesforce developer skills in 2025.pdf
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PPTX
ai tools demonstartion for schools and inter college
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
System and Network Administraation Chapter 3
PPT
JAVA ppt tutorial basics to learn java programming
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
System and Network Administration Chapter 2
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
Introduction to Artificial Intelligence
PDF
AI in Product Development-omnex systems
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
ISO 45001 Occupational Health and Safety Management System
The Five Best AI Cover Tools in 2025.docx
top salesforce developer skills in 2025.pdf
Operating system designcfffgfgggggggvggggggggg
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
ai tools demonstartion for schools and inter college
Upgrade and Innovation Strategies for SAP ERP Customers
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
System and Network Administraation Chapter 3
JAVA ppt tutorial basics to learn java programming
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Odoo POS Development Services by CandidRoot Solutions
Wondershare Filmora 15 Crack With Activation Key [2025
System and Network Administration Chapter 2
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
How Creative Agencies Leverage Project Management Software.pdf
Introduction to Artificial Intelligence
AI in Product Development-omnex systems

Overview the Challenges and Limitations of Android App Automation with Espresso by Jagmit Singh

  • 1. Overcome the Challenges and Limitations of Android App Automation with Espresso Myself Jagmit Singh is a Senior Automation Engineer at CBC Digital Labs, responsible for UI Automation of Listen Apps
  • 2. What is CBC? Canadian Broadcasting Corporation branded as CBC/Radio Canada is National Public Broadcaster for TV and Radio
  • 3. Agenda ● What’s Espresso? ● Challenges in Android UI Automation ● Why Use Expresso? ● Writing Espresso Tests ● Espresso & TestButler ● Espresso & UIAutomator ● Continuous UI Testing using Espresso and Jenkins
  • 4. What’s Espresso? ● A testing framework for Android to write reliable UI tests ● Developed internally by Google ● Run on devices running Android 2.2 and higher ● Instrumentation-based API works with AndroidJUnitRunner
  • 5. Challenges in Android UI Automation. ● Tests are Flaky! ● Tests are Slow! ● Scaling Automation Scope - Testing Outside the App ● Some Difficulty in locating UI elements!
  • 6. Why Use Espresso? ● Fast and Reliable ● Support testing activities outside the App ● Espresso tests are developed within the App ● Native Platform Developed by Google -- Always ahead of the curve
  • 8. Setup Espresso with Gradle Add Dependencies to build.gradle android { defaultConfig { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } } dependencies { androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0' androidTestImplementation 'com.linkedin.testbutler:test-butler-library:1.4.0' }
  • 9. Android Test Rules ● Make Use of JUnit @Rule Annotations ● Retry Rule @Rule public final RetryRule retry = new RetryRule(); ● Activity Test Rule The Activity under the Rule will be launched again in each Test @Rule public ActivityTestRule activityRule = new ActivityTestRule<>(MyActivity.class);
  • 12. Espresso & Test Butler
  • 13. How TestButler Works? ❖ Two Part Project: App and Library ❖ Espresso Tests depends on Library ❖ Install TestButler App on Emulator prior to running Tests ❖ TestButler App have permissions to change Device Settings
  • 14. Espresso & Test Butler ❖ Controlling the environment with Espresso Tests ❖ Disable crash & App Not Responding (ANR) dialogs ❖ Turn Wifi ON/OFF ❖ Change Locale ❖ Set Screen Orientation ❖ Disable Animations - Espresso Tests Run Reliably
  • 16. Espresso & UI Automator
  • 17. Espresso & UI Automator Espresso allow to test many things inside your application in simple way UiAutomator allows test to access many system stuff, e.g. notification, another applications, contacts, dialer, etc.
  • 19. Continuous UI Testing and Deployment with Espresso and Jenkins Execution at Firebase Espresso Tests Selected builds pushed to Fabric for Testing