SlideShare a Scribd company logo
1 of 31
Download to read offline
Íntel Software and Services Group
UsingespressoanduiautomatorEduardo Carrara
Developer Evangelist – Intel Developers Relations Division
Intel Software and Services Group
#AndroidOnIntel
2
+EduardoCarraraDeAraujo
https://www.facebook.com/ducarrara
@DuCarrara
br.linkedin.com/in/eduardocarrara/
ecarrara-araujo
Intel Software and Services Group 3
Intel Information Technology
“I choose a lazy person to do a hard job.
Because a lazy person will find an easy way to do it.”
- Bill Gates
4
Image by Karla Vidal @ http://www.flickr.com/photos/63721650@N00/3661526274
Creative Commons cc-by-2.0
Intel Software and Services Group 5
Challenges
Automation Fragmentation
Intel Software and Services Group 6
JUnit UI Automator
Android Testing Support Library
Intel Software and Services Group 8
JUnit
Intel Software and Services Group 9
JUnit
@RunWith(AndroidJUnit4.class)
public class SimpleTest {
@Before public void setUp() { }
@Test public void testSomething() { }
@After public void cleanUp() { }
}
Intel Software and Services Group
Instrumentation
11
• Android Components Context Access;
• Components Lifecycle Control;
• Component Loading Control;
• System Events (e.g.: Broadcasts)
• InstrumentationTestRunner
• AndroidJUnitRunner
• GoogleInstrumentationTestRunner
Intel Software and Services Group
Espresso
12
• Simplifies the UI Test
Process within your App
• Methods for:
• View matching
• Checks
• UI Events
Intel Software and Services Group 13
Espresso - Configuration
dependencies {
androidTestCompile 'com.android.support.test:runner:0.3'
androidTestCompile 'com.android.support.test:rules:0.3'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2'
}
build.gradle
Desabilitar nas opções do desenvolvedor (no device):
• Window Animation Scale
• Transition Animation Scale
• Animator Duration Scale
Intel Software and Services Group 14
Espresso – Trecho Mínimo de Código
Espresso Cheat Sheet
@Test public void testSuccessfulAwesomeFeature() {
//na view com o id myViewId faça um doubleClick
onView(withId(myViewId)).perform(doubleClick());
}
Entry Point
Critério
de
Seleção da View
Ação
Na
ViewInteraction
Critérios
Da
Ação
Intel Software and Services Group 15
Espresso – Vilibra Case
• Virtual Librarian
• Help to remember the books I
lend
• How to automate the lend
details view?
• Class:
TestViewLendedBookDetailFlow
Intel Software and Services Group 16
Check the code!
Instrumented Test Package:
vilibra/app/src/main/androidTest/java/ecarrara/eng/vilibra/
Test Class:
TestViewLendedBookDetailFlow.java
Intel Software and Services Group
UIAutomator
26
• Cross App Testing
• Instrumentation Based
• Interact with visible
elements using
descriptors (like text).
Intel Software and Services Group 27
UIAutomator - Configuração
build.gradle
É necessário inspecionar os componentes visuais das apps alvo para garantir que o
UIAutomator consiga localizá-los.
Isso significa ter labels de texto visíveis, a propriedade android:contentDescription
preenchida, ou ainda a propriedade android:hint (para EditTexts)
dependencies {
androidTestCompile 'com.android.support.test:runner:0.3'
androidTestCompile 'com.android.support.test:rules:0.3'
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-
v18:2.1.1'
}
Intel Software and Services Group 28
UIAutomator – Trecho Minimo de Código
@Test public void myAwesomeTest() throws UiObjectNotFoundException {
// encontre o objeto com as caracteristicas e faça um click
mUiDevice.findObject(
new UiSelector()
.className("class-name")
.resourceId("resource-id")
.text("view-text"))
.click();
}
Testing UI for Multiple Apps
Entry Point
Critérios
de
Seleção da View
Ação
no
UIObject
Intel Software and Services Group 30
UIAutomator - uiautomatorviewer
Intel Software and Services Group 31
UIAutomator – Vilibra Case
• New case: automate the entire
lend process test.
• Class: TestLendBookFlow
Intel Software and Services Group 32
Check the code!
Instrumented Test Package:
vilibra/app/src/main/androidTest/java/ecarrara/eng/vilibra/
Test Class:
TestLendBookFlow.java
Intel Software and Services Group 47
Fragmentation
Screen size/density variety
Different Processor
Many OS versions
Intel Software and Services Group 48
Intel Software and Services Group 49
Intel Software and Services Group 50
Intel Software and Services Group 51
Intel Information Technology
What is next?
56
• Go ahead and automate your app testing!
• How to integrate continous integration and delivery with Android?
• Code Coverage
• Mocking
“If you don’t like testing your product, most likely your
customers won’t like to test it either.”
- Anonymous
Intel Software and Services Group 57
Intel Developer Zone
https://software.intel.com/en-us/android/app-testing
Intel Software and Services Group
Thanks!
58
+EduardoCarraraDeAraujo
https://www.facebook.com/ducarrara
@DuCarrara
br.linkedin.com/in/eduardocarrara/
ecarrara-araujo/vilibra
Intel Software and Services Group 59
References
• Android Testing: https://developer.android.com/tools/testing/testing_android.html
• Android Unit Testing Support: http://tools.android.com/tech-docs/unit-testing-support
• UI Testing: https://developer.android.com/training/testing/ui-testing/index.html
• Android Testing Support Library: https://developer.android.com/tools/testing-support-
library
• Android Instrumentation:
http://developer.android.com/tools/testing/testing_android.html#Instrumentation
• Junit: http://junit.org
• Testdroid: http://testdroid.com
• Intel App Testing Page: https://software.intel.com/en-us/android/app-testing
Intel Software and Services Group 60
Bonus References!
Android Testing Support Library (ATSL)
• Android Testing Support Library: https://google.github.io/android-testing-support-library/
• Release Announcement:
https://plus.google.com/+AndroidDevelopers/posts/SXVtgnoKcAY?linkId=17056826
Placeholder Footer Copy / BU Logo or Name Goes Here

More Related Content

What's hot

Android UI Testing with Espresso
Android UI Testing with EspressoAndroid UI Testing with Espresso
Android UI Testing with EspressoGary Cheng
 
Robotium at Android Only 2010-09-29
Robotium at Android Only 2010-09-29Robotium at Android Only 2010-09-29
Robotium at Android Only 2010-09-29Hugo Josefson
 
Android testing
Android testingAndroid testing
Android testingBitbar
 
Android Automation Using Robotium
Android Automation Using RobotiumAndroid Automation Using Robotium
Android Automation Using RobotiumMindfire Solutions
 
Unit Testing Android Applications
Unit Testing Android ApplicationsUnit Testing Android Applications
Unit Testing Android ApplicationsRody Middelkoop
 
Inside Android Testing
Inside Android TestingInside Android Testing
Inside Android TestingFernando Cejas
 
Next Step, Android Studio!
Next Step, Android Studio!Next Step, Android Studio!
Next Step, Android Studio!Édipo Souza
 
Mobile App Testing ScanAgile 2012
Mobile App Testing ScanAgile 2012Mobile App Testing ScanAgile 2012
Mobile App Testing ScanAgile 2012Daniel Knott
 
Android development session 5 - Debug android studio
Android development   session 5 - Debug android studioAndroid development   session 5 - Debug android studio
Android development session 5 - Debug android studioFarabi Technology Middle East
 
Getting Started with XCTest and XCUITest for iOS App Testing
Getting Started with XCTest and XCUITest for iOS App TestingGetting Started with XCTest and XCUITest for iOS App Testing
Getting Started with XCTest and XCUITest for iOS App TestingBitbar
 
Android, Gradle & Dependecies
Android, Gradle & DependeciesAndroid, Gradle & Dependecies
Android, Gradle & DependeciesÉdipo Souza
 
Appium Mobile Testing: Nakov at BurgasConf - July 2021
Appium Mobile Testing: Nakov at BurgasConf - July 2021Appium Mobile Testing: Nakov at BurgasConf - July 2021
Appium Mobile Testing: Nakov at BurgasConf - July 2021Svetlin Nakov
 
Test Automation On Android Platform Using Robotium
Test Automation On Android Platform Using RobotiumTest Automation On Android Platform Using Robotium
Test Automation On Android Platform Using RobotiumIndicThreads
 
Different Android Test Automation Frameworks - What Works You the Best?
Different Android Test Automation Frameworks - What Works You the Best?Different Android Test Automation Frameworks - What Works You the Best?
Different Android Test Automation Frameworks - What Works You the Best?Bitbar
 
How to create android applications
How to create android applicationsHow to create android applications
How to create android applicationsTOPS Technologies
 
Creating the first app with android studio
Creating the first app with android studioCreating the first app with android studio
Creating the first app with android studioParinita03
 

What's hot (20)

Robotium Tutorial
Robotium TutorialRobotium Tutorial
Robotium Tutorial
 
Android UI Testing with Espresso
Android UI Testing with EspressoAndroid UI Testing with Espresso
Android UI Testing with Espresso
 
Robotium at Android Only 2010-09-29
Robotium at Android Only 2010-09-29Robotium at Android Only 2010-09-29
Robotium at Android Only 2010-09-29
 
Android testing
Android testingAndroid testing
Android testing
 
Android testing part i
Android testing part iAndroid testing part i
Android testing part i
 
Android Automation Using Robotium
Android Automation Using RobotiumAndroid Automation Using Robotium
Android Automation Using Robotium
 
Unit Testing Android Applications
Unit Testing Android ApplicationsUnit Testing Android Applications
Unit Testing Android Applications
 
Inside Android Testing
Inside Android TestingInside Android Testing
Inside Android Testing
 
Next Step, Android Studio!
Next Step, Android Studio!Next Step, Android Studio!
Next Step, Android Studio!
 
Dagger for android
Dagger for androidDagger for android
Dagger for android
 
Mobile App Testing ScanAgile 2012
Mobile App Testing ScanAgile 2012Mobile App Testing ScanAgile 2012
Mobile App Testing ScanAgile 2012
 
Espresso
EspressoEspresso
Espresso
 
Android development session 5 - Debug android studio
Android development   session 5 - Debug android studioAndroid development   session 5 - Debug android studio
Android development session 5 - Debug android studio
 
Getting Started with XCTest and XCUITest for iOS App Testing
Getting Started with XCTest and XCUITest for iOS App TestingGetting Started with XCTest and XCUITest for iOS App Testing
Getting Started with XCTest and XCUITest for iOS App Testing
 
Android, Gradle & Dependecies
Android, Gradle & DependeciesAndroid, Gradle & Dependecies
Android, Gradle & Dependecies
 
Appium Mobile Testing: Nakov at BurgasConf - July 2021
Appium Mobile Testing: Nakov at BurgasConf - July 2021Appium Mobile Testing: Nakov at BurgasConf - July 2021
Appium Mobile Testing: Nakov at BurgasConf - July 2021
 
Test Automation On Android Platform Using Robotium
Test Automation On Android Platform Using RobotiumTest Automation On Android Platform Using Robotium
Test Automation On Android Platform Using Robotium
 
Different Android Test Automation Frameworks - What Works You the Best?
Different Android Test Automation Frameworks - What Works You the Best?Different Android Test Automation Frameworks - What Works You the Best?
Different Android Test Automation Frameworks - What Works You the Best?
 
How to create android applications
How to create android applicationsHow to create android applications
How to create android applications
 
Creating the first app with android studio
Creating the first app with android studioCreating the first app with android studio
Creating the first app with android studio
 

Viewers also liked

A guideline for using hangouts on air for company collaboration
A guideline for using hangouts on air for company collaborationA guideline for using hangouts on air for company collaboration
A guideline for using hangouts on air for company collaborationMars Cyrillo
 
Indo além com Automação de Testes de Apps Android
Indo além com Automação de Testes de Apps AndroidIndo além com Automação de Testes de Apps Android
Indo além com Automação de Testes de Apps AndroidEduardo Carrara de Araujo
 
Do You Enjoy Espresso in Android App Testing?
Do You Enjoy Espresso in Android App Testing?Do You Enjoy Espresso in Android App Testing?
Do You Enjoy Espresso in Android App Testing?Bitbar
 
Tech Talk #5 : Android Automation Test with Espresso - Trần Văn Toàn
Tech Talk #5 : Android Automation Test with Espresso - Trần Văn ToànTech Talk #5 : Android Automation Test with Espresso - Trần Văn Toàn
Tech Talk #5 : Android Automation Test with Espresso - Trần Văn ToànNexus FrontierTech
 
Writing and using Hamcrest Matchers
Writing and using Hamcrest MatchersWriting and using Hamcrest Matchers
Writing and using Hamcrest MatchersShai Yallin
 
Unit testing on Android (Droidcon Dubai 2015)
Unit testing on Android (Droidcon Dubai 2015)Unit testing on Android (Droidcon Dubai 2015)
Unit testing on Android (Droidcon Dubai 2015)Danny Preussler
 
Screenshots Test spoon + espresso
Screenshots Test spoon + espressoScreenshots Test spoon + espresso
Screenshots Test spoon + espressoShinobu Okano
 

Viewers also liked (8)

A guideline for using hangouts on air for company collaboration
A guideline for using hangouts on air for company collaborationA guideline for using hangouts on air for company collaboration
A guideline for using hangouts on air for company collaboration
 
Indo além com Automação de Testes de Apps Android
Indo além com Automação de Testes de Apps AndroidIndo além com Automação de Testes de Apps Android
Indo além com Automação de Testes de Apps Android
 
Do You Enjoy Espresso in Android App Testing?
Do You Enjoy Espresso in Android App Testing?Do You Enjoy Espresso in Android App Testing?
Do You Enjoy Espresso in Android App Testing?
 
Espresso Barista
Espresso BaristaEspresso Barista
Espresso Barista
 
Tech Talk #5 : Android Automation Test with Espresso - Trần Văn Toàn
Tech Talk #5 : Android Automation Test with Espresso - Trần Văn ToànTech Talk #5 : Android Automation Test with Espresso - Trần Văn Toàn
Tech Talk #5 : Android Automation Test with Espresso - Trần Văn Toàn
 
Writing and using Hamcrest Matchers
Writing and using Hamcrest MatchersWriting and using Hamcrest Matchers
Writing and using Hamcrest Matchers
 
Unit testing on Android (Droidcon Dubai 2015)
Unit testing on Android (Droidcon Dubai 2015)Unit testing on Android (Droidcon Dubai 2015)
Unit testing on Android (Droidcon Dubai 2015)
 
Screenshots Test spoon + espresso
Screenshots Test spoon + espressoScreenshots Test spoon + espresso
Screenshots Test spoon + espresso
 

Similar to Utilizando Espresso e UIAutomator no Teste de Apps Android

Unit Testing Using Mockito in Android (1).pdf
Unit Testing Using Mockito in Android (1).pdfUnit Testing Using Mockito in Android (1).pdf
Unit Testing Using Mockito in Android (1).pdfKaty Slemon
 
Android Architecture Components with Kotlin
Android Architecture Components with KotlinAndroid Architecture Components with Kotlin
Android Architecture Components with KotlinAdit Lal
 
Simple stock market analysis
Simple stock market analysisSimple stock market analysis
Simple stock market analysislynneblue
 
Unity and Azure Mobile Services using Prime31 plugin
Unity and Azure Mobile Services using Prime31 pluginUnity and Azure Mobile Services using Prime31 plugin
Unity and Azure Mobile Services using Prime31 pluginDavid Douglas
 
Android Jump Start
Android Jump StartAndroid Jump Start
Android Jump StartHaim Michael
 
Testando Apps Android na Nuvem
Testando Apps Android na NuvemTestando Apps Android na Nuvem
Testando Apps Android na Nuvemtdc-globalcode
 
Handling action bar in Android
Handling action bar in AndroidHandling action bar in Android
Handling action bar in Androidindiangarg
 
Use Eclipse technologies to build a modern embedded IDE
Use Eclipse technologies to build a modern embedded IDEUse Eclipse technologies to build a modern embedded IDE
Use Eclipse technologies to build a modern embedded IDEBenjamin Cabé
 
Unit Testing on Android - Droidcon Berlin 2015
Unit Testing on Android - Droidcon Berlin 2015Unit Testing on Android - Droidcon Berlin 2015
Unit Testing on Android - Droidcon Berlin 2015Buşra Deniz, CSM
 
Advanced Coded UI Testing
Advanced Coded UI TestingAdvanced Coded UI Testing
Advanced Coded UI TestingShai Raiten
 
Android应用开发简介
Android应用开发简介Android应用开发简介
Android应用开发简介easychen
 
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023Nicolas HAAN
 
Building Modern Apps using Android Architecture Components
Building Modern Apps using Android Architecture ComponentsBuilding Modern Apps using Android Architecture Components
Building Modern Apps using Android Architecture ComponentsHassan Abid
 
How Android Architecture Components can Help You Improve Your App’s Design?
How Android Architecture Components can Help You Improve Your App’s Design?How Android Architecture Components can Help You Improve Your App’s Design?
How Android Architecture Components can Help You Improve Your App’s Design?Paul Cook
 
What's new in Android at I/O'16
What's new in Android at I/O'16What's new in Android at I/O'16
What's new in Android at I/O'16Elif Boncuk
 

Similar to Utilizando Espresso e UIAutomator no Teste de Apps Android (20)

Stmik bandung
Stmik bandungStmik bandung
Stmik bandung
 
Unit Testing Using Mockito in Android (1).pdf
Unit Testing Using Mockito in Android (1).pdfUnit Testing Using Mockito in Android (1).pdf
Unit Testing Using Mockito in Android (1).pdf
 
Android Data Binding
Android Data BindingAndroid Data Binding
Android Data Binding
 
Android Architecture Components with Kotlin
Android Architecture Components with KotlinAndroid Architecture Components with Kotlin
Android Architecture Components with Kotlin
 
Simple stock market analysis
Simple stock market analysisSimple stock market analysis
Simple stock market analysis
 
Testando Sua App Android na Nuvem
Testando Sua App Android na NuvemTestando Sua App Android na Nuvem
Testando Sua App Android na Nuvem
 
Android101
Android101Android101
Android101
 
Unity and Azure Mobile Services using Prime31 plugin
Unity and Azure Mobile Services using Prime31 pluginUnity and Azure Mobile Services using Prime31 plugin
Unity and Azure Mobile Services using Prime31 plugin
 
Android Jump Start
Android Jump StartAndroid Jump Start
Android Jump Start
 
Testando Apps Android na Nuvem
Testando Apps Android na NuvemTestando Apps Android na Nuvem
Testando Apps Android na Nuvem
 
Handling action bar in Android
Handling action bar in AndroidHandling action bar in Android
Handling action bar in Android
 
Use Eclipse technologies to build a modern embedded IDE
Use Eclipse technologies to build a modern embedded IDEUse Eclipse technologies to build a modern embedded IDE
Use Eclipse technologies to build a modern embedded IDE
 
Unit Testing on Android - Droidcon Berlin 2015
Unit Testing on Android - Droidcon Berlin 2015Unit Testing on Android - Droidcon Berlin 2015
Unit Testing on Android - Droidcon Berlin 2015
 
Testing Your App in the Cloud
Testing Your App in the CloudTesting Your App in the Cloud
Testing Your App in the Cloud
 
Advanced Coded UI Testing
Advanced Coded UI TestingAdvanced Coded UI Testing
Advanced Coded UI Testing
 
Android应用开发简介
Android应用开发简介Android应用开发简介
Android应用开发简介
 
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
 
Building Modern Apps using Android Architecture Components
Building Modern Apps using Android Architecture ComponentsBuilding Modern Apps using Android Architecture Components
Building Modern Apps using Android Architecture Components
 
How Android Architecture Components can Help You Improve Your App’s Design?
How Android Architecture Components can Help You Improve Your App’s Design?How Android Architecture Components can Help You Improve Your App’s Design?
How Android Architecture Components can Help You Improve Your App’s Design?
 
What's new in Android at I/O'16
What's new in Android at I/O'16What's new in Android at I/O'16
What's new in Android at I/O'16
 

More from Eduardo Carrara de Araujo

Só um appzinho aê!? - O guia de sobrevivência para o dev da ideia inovadora a...
Só um appzinho aê!? - O guia de sobrevivência para o dev da ideia inovadora a...Só um appzinho aê!? - O guia de sobrevivência para o dev da ideia inovadora a...
Só um appzinho aê!? - O guia de sobrevivência para o dev da ideia inovadora a...Eduardo Carrara de Araujo
 
Implementation of a Participatory Sensing Solution to Collect Data About Pave...
Implementation of a Participatory Sensing Solution to Collect Data About Pave...Implementation of a Participatory Sensing Solution to Collect Data About Pave...
Implementation of a Participatory Sensing Solution to Collect Data About Pave...Eduardo Carrara de Araujo
 

More from Eduardo Carrara de Araujo (16)

Só um appzinho aê!? - O guia de sobrevivência para o dev da ideia inovadora a...
Só um appzinho aê!? - O guia de sobrevivência para o dev da ideia inovadora a...Só um appzinho aê!? - O guia de sobrevivência para o dev da ideia inovadora a...
Só um appzinho aê!? - O guia de sobrevivência para o dev da ideia inovadora a...
 
Melhorando seu App com Kotlin e Testes
Melhorando seu App com Kotlin e TestesMelhorando seu App com Kotlin e Testes
Melhorando seu App com Kotlin e Testes
 
Android apps ci
Android apps ciAndroid apps ci
Android apps ci
 
2016 - Por que mobile?
2016 - Por que mobile?2016 - Por que mobile?
2016 - Por que mobile?
 
Testes: Por onde Começar?
Testes: Por onde Começar?Testes: Por onde Começar?
Testes: Por onde Começar?
 
Android ndk: Entering the native world
Android ndk: Entering the native worldAndroid ndk: Entering the native world
Android ndk: Entering the native world
 
Android NDK: Entrando no Mundo Nativo
Android NDK: Entrando no Mundo NativoAndroid NDK: Entrando no Mundo Nativo
Android NDK: Entrando no Mundo Nativo
 
Implementation of a Participatory Sensing Solution to Collect Data About Pave...
Implementation of a Participatory Sensing Solution to Collect Data About Pave...Implementation of a Participatory Sensing Solution to Collect Data About Pave...
Implementation of a Participatory Sensing Solution to Collect Data About Pave...
 
GDG ABC - Aventura 2015
GDG ABC - Aventura 2015GDG ABC - Aventura 2015
GDG ABC - Aventura 2015
 
Why mobile?
Why mobile?Why mobile?
Why mobile?
 
Android M - Getting Started
Android M - Getting StartedAndroid M - Getting Started
Android M - Getting Started
 
Começando com Android (#AndroidOnIntel)
Começando com Android (#AndroidOnIntel)Começando com Android (#AndroidOnIntel)
Começando com Android (#AndroidOnIntel)
 
Android Auto Basics
Android Auto BasicsAndroid Auto Basics
Android Auto Basics
 
Debugging in Android
Debugging in AndroidDebugging in Android
Debugging in Android
 
Android 101: Do Plano ao Play
Android 101: Do Plano ao PlayAndroid 101: Do Plano ao Play
Android 101: Do Plano ao Play
 
Android 101: Do Plano ao Play em 30 minutos
Android 101: Do Plano ao Play em 30 minutosAndroid 101: Do Plano ao Play em 30 minutos
Android 101: Do Plano ao Play em 30 minutos
 

Recently uploaded

Modern binary build systems - PyCon 2024
Modern binary build systems - PyCon 2024Modern binary build systems - PyCon 2024
Modern binary build systems - PyCon 2024Henry Schreiner
 
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024SimonedeGijt
 
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...naitiksharma1124
 
GraphSummit Milan - Visione e roadmap del prodotto Neo4j
GraphSummit Milan - Visione e roadmap del prodotto Neo4jGraphSummit Milan - Visione e roadmap del prodotto Neo4j
GraphSummit Milan - Visione e roadmap del prodotto Neo4jNeo4j
 
The Strategic Impact of Buying vs Building in Test Automation
The Strategic Impact of Buying vs Building in Test AutomationThe Strategic Impact of Buying vs Building in Test Automation
The Strategic Impact of Buying vs Building in Test AutomationElement34
 
Automate your OpenSIPS config tests - OpenSIPS Summit 2024
Automate your OpenSIPS config tests - OpenSIPS Summit 2024Automate your OpenSIPS config tests - OpenSIPS Summit 2024
Automate your OpenSIPS config tests - OpenSIPS Summit 2024Andreas Granig
 
Encryption Recap: A Refresher on Key Concepts
Encryption Recap: A Refresher on Key ConceptsEncryption Recap: A Refresher on Key Concepts
Encryption Recap: A Refresher on Key Conceptsthomashtkim
 
BusinessGPT - Security and Governance for Generative AI
BusinessGPT  - Security and Governance for Generative AIBusinessGPT  - Security and Governance for Generative AI
BusinessGPT - Security and Governance for Generative AIAGATSoftware
 
Navigation in flutter – how to add stack, tab, and drawer navigators to your ...
Navigation in flutter – how to add stack, tab, and drawer navigators to your ...Navigation in flutter – how to add stack, tab, and drawer navigators to your ...
Navigation in flutter – how to add stack, tab, and drawer navigators to your ...Flutter Agency
 
Lessons Learned from Building a Serverless Notifications System.pdf
Lessons Learned from Building a Serverless Notifications System.pdfLessons Learned from Building a Serverless Notifications System.pdf
Lessons Learned from Building a Serverless Notifications System.pdfSrushith Repakula
 
Software Engineering - Introduction + Process Models + Requirements Engineering
Software Engineering - Introduction + Process Models + Requirements EngineeringSoftware Engineering - Introduction + Process Models + Requirements Engineering
Software Engineering - Introduction + Process Models + Requirements EngineeringPrakhyath Rai
 
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale IbridaUNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale IbridaNeo4j
 
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-CloudAlluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-CloudAlluxio, Inc.
 
Weeding your micro service landscape.pdf
Weeding your micro service landscape.pdfWeeding your micro service landscape.pdf
Weeding your micro service landscape.pdftimtebeek1
 
Evolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI EraEvolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI Eraconfluent
 
Prompt Engineering - an Art, a Science, or your next Job Title?
Prompt Engineering - an Art, a Science, or your next Job Title?Prompt Engineering - an Art, a Science, or your next Job Title?
Prompt Engineering - an Art, a Science, or your next Job Title?Maxim Salnikov
 
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...Andrea Goulet
 

Recently uploaded (20)

Modern binary build systems - PyCon 2024
Modern binary build systems - PyCon 2024Modern binary build systems - PyCon 2024
Modern binary build systems - PyCon 2024
 
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
 
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
 
GraphSummit Milan - Visione e roadmap del prodotto Neo4j
GraphSummit Milan - Visione e roadmap del prodotto Neo4jGraphSummit Milan - Visione e roadmap del prodotto Neo4j
GraphSummit Milan - Visione e roadmap del prodotto Neo4j
 
The Strategic Impact of Buying vs Building in Test Automation
The Strategic Impact of Buying vs Building in Test AutomationThe Strategic Impact of Buying vs Building in Test Automation
The Strategic Impact of Buying vs Building in Test Automation
 
Automate your OpenSIPS config tests - OpenSIPS Summit 2024
Automate your OpenSIPS config tests - OpenSIPS Summit 2024Automate your OpenSIPS config tests - OpenSIPS Summit 2024
Automate your OpenSIPS config tests - OpenSIPS Summit 2024
 
Encryption Recap: A Refresher on Key Concepts
Encryption Recap: A Refresher on Key ConceptsEncryption Recap: A Refresher on Key Concepts
Encryption Recap: A Refresher on Key Concepts
 
BusinessGPT - Security and Governance for Generative AI
BusinessGPT  - Security and Governance for Generative AIBusinessGPT  - Security and Governance for Generative AI
BusinessGPT - Security and Governance for Generative AI
 
Navigation in flutter – how to add stack, tab, and drawer navigators to your ...
Navigation in flutter – how to add stack, tab, and drawer navigators to your ...Navigation in flutter – how to add stack, tab, and drawer navigators to your ...
Navigation in flutter – how to add stack, tab, and drawer navigators to your ...
 
Lessons Learned from Building a Serverless Notifications System.pdf
Lessons Learned from Building a Serverless Notifications System.pdfLessons Learned from Building a Serverless Notifications System.pdf
Lessons Learned from Building a Serverless Notifications System.pdf
 
Abortion Clinic Pretoria ](+27832195400*)[ Abortion Clinic Near Me ● Abortion...
Abortion Clinic Pretoria ](+27832195400*)[ Abortion Clinic Near Me ● Abortion...Abortion Clinic Pretoria ](+27832195400*)[ Abortion Clinic Near Me ● Abortion...
Abortion Clinic Pretoria ](+27832195400*)[ Abortion Clinic Near Me ● Abortion...
 
Software Engineering - Introduction + Process Models + Requirements Engineering
Software Engineering - Introduction + Process Models + Requirements EngineeringSoftware Engineering - Introduction + Process Models + Requirements Engineering
Software Engineering - Introduction + Process Models + Requirements Engineering
 
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale IbridaUNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
 
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-CloudAlluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
 
Weeding your micro service landscape.pdf
Weeding your micro service landscape.pdfWeeding your micro service landscape.pdf
Weeding your micro service landscape.pdf
 
Evolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI EraEvolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI Era
 
Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...
Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...
Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...
 
Prompt Engineering - an Art, a Science, or your next Job Title?
Prompt Engineering - an Art, a Science, or your next Job Title?Prompt Engineering - an Art, a Science, or your next Job Title?
Prompt Engineering - an Art, a Science, or your next Job Title?
 
Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...
Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...
Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...
 
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
 

Utilizando Espresso e UIAutomator no Teste de Apps Android

  • 1. Íntel Software and Services Group UsingespressoanduiautomatorEduardo Carrara Developer Evangelist – Intel Developers Relations Division
  • 2. Intel Software and Services Group #AndroidOnIntel 2 +EduardoCarraraDeAraujo https://www.facebook.com/ducarrara @DuCarrara br.linkedin.com/in/eduardocarrara/ ecarrara-araujo
  • 3. Intel Software and Services Group 3
  • 4. Intel Information Technology “I choose a lazy person to do a hard job. Because a lazy person will find an easy way to do it.” - Bill Gates 4 Image by Karla Vidal @ http://www.flickr.com/photos/63721650@N00/3661526274 Creative Commons cc-by-2.0
  • 5. Intel Software and Services Group 5 Challenges Automation Fragmentation
  • 6. Intel Software and Services Group 6 JUnit UI Automator Android Testing Support Library
  • 7. Intel Software and Services Group 8 JUnit
  • 8. Intel Software and Services Group 9 JUnit @RunWith(AndroidJUnit4.class) public class SimpleTest { @Before public void setUp() { } @Test public void testSomething() { } @After public void cleanUp() { } }
  • 9. Intel Software and Services Group Instrumentation 11 • Android Components Context Access; • Components Lifecycle Control; • Component Loading Control; • System Events (e.g.: Broadcasts) • InstrumentationTestRunner • AndroidJUnitRunner • GoogleInstrumentationTestRunner
  • 10. Intel Software and Services Group Espresso 12 • Simplifies the UI Test Process within your App • Methods for: • View matching • Checks • UI Events
  • 11. Intel Software and Services Group 13 Espresso - Configuration dependencies { androidTestCompile 'com.android.support.test:runner:0.3' androidTestCompile 'com.android.support.test:rules:0.3' androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2' } build.gradle Desabilitar nas opções do desenvolvedor (no device): • Window Animation Scale • Transition Animation Scale • Animator Duration Scale
  • 12. Intel Software and Services Group 14 Espresso – Trecho Mínimo de Código Espresso Cheat Sheet @Test public void testSuccessfulAwesomeFeature() { //na view com o id myViewId faça um doubleClick onView(withId(myViewId)).perform(doubleClick()); } Entry Point Critério de Seleção da View Ação Na ViewInteraction Critérios Da Ação
  • 13. Intel Software and Services Group 15 Espresso – Vilibra Case • Virtual Librarian • Help to remember the books I lend • How to automate the lend details view? • Class: TestViewLendedBookDetailFlow
  • 14. Intel Software and Services Group 16 Check the code! Instrumented Test Package: vilibra/app/src/main/androidTest/java/ecarrara/eng/vilibra/ Test Class: TestViewLendedBookDetailFlow.java
  • 15. Intel Software and Services Group UIAutomator 26 • Cross App Testing • Instrumentation Based • Interact with visible elements using descriptors (like text).
  • 16. Intel Software and Services Group 27 UIAutomator - Configuração build.gradle É necessário inspecionar os componentes visuais das apps alvo para garantir que o UIAutomator consiga localizá-los. Isso significa ter labels de texto visíveis, a propriedade android:contentDescription preenchida, ou ainda a propriedade android:hint (para EditTexts) dependencies { androidTestCompile 'com.android.support.test:runner:0.3' androidTestCompile 'com.android.support.test:rules:0.3' androidTestCompile 'com.android.support.test.uiautomator:uiautomator- v18:2.1.1' }
  • 17. Intel Software and Services Group 28 UIAutomator – Trecho Minimo de Código @Test public void myAwesomeTest() throws UiObjectNotFoundException { // encontre o objeto com as caracteristicas e faça um click mUiDevice.findObject( new UiSelector() .className("class-name") .resourceId("resource-id") .text("view-text")) .click(); } Testing UI for Multiple Apps Entry Point Critérios de Seleção da View Ação no UIObject
  • 18. Intel Software and Services Group 30 UIAutomator - uiautomatorviewer
  • 19. Intel Software and Services Group 31 UIAutomator – Vilibra Case • New case: automate the entire lend process test. • Class: TestLendBookFlow
  • 20. Intel Software and Services Group 32 Check the code! Instrumented Test Package: vilibra/app/src/main/androidTest/java/ecarrara/eng/vilibra/ Test Class: TestLendBookFlow.java
  • 21. Intel Software and Services Group 47 Fragmentation Screen size/density variety Different Processor Many OS versions
  • 22. Intel Software and Services Group 48
  • 23. Intel Software and Services Group 49
  • 24. Intel Software and Services Group 50
  • 25. Intel Software and Services Group 51
  • 26. Intel Information Technology What is next? 56 • Go ahead and automate your app testing! • How to integrate continous integration and delivery with Android? • Code Coverage • Mocking “If you don’t like testing your product, most likely your customers won’t like to test it either.” - Anonymous
  • 27. Intel Software and Services Group 57 Intel Developer Zone https://software.intel.com/en-us/android/app-testing
  • 28. Intel Software and Services Group Thanks! 58 +EduardoCarraraDeAraujo https://www.facebook.com/ducarrara @DuCarrara br.linkedin.com/in/eduardocarrara/ ecarrara-araujo/vilibra
  • 29. Intel Software and Services Group 59 References • Android Testing: https://developer.android.com/tools/testing/testing_android.html • Android Unit Testing Support: http://tools.android.com/tech-docs/unit-testing-support • UI Testing: https://developer.android.com/training/testing/ui-testing/index.html • Android Testing Support Library: https://developer.android.com/tools/testing-support- library • Android Instrumentation: http://developer.android.com/tools/testing/testing_android.html#Instrumentation • Junit: http://junit.org • Testdroid: http://testdroid.com • Intel App Testing Page: https://software.intel.com/en-us/android/app-testing
  • 30. Intel Software and Services Group 60 Bonus References! Android Testing Support Library (ATSL) • Android Testing Support Library: https://google.github.io/android-testing-support-library/ • Release Announcement: https://plus.google.com/+AndroidDevelopers/posts/SXVtgnoKcAY?linkId=17056826
  • 31. Placeholder Footer Copy / BU Logo or Name Goes Here