SlideShare a Scribd company logo
Í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

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

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

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
Benjamin Cabé
 

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

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

Recently uploaded (20)

Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
 
Breaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdfBreaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdf
 
iGaming Platform & Lottery Solutions by Skilrock
iGaming Platform & Lottery Solutions by SkilrockiGaming Platform & Lottery Solutions by Skilrock
iGaming Platform & Lottery Solutions by Skilrock
 
Studiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareStudiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting software
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
 
GraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisGraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysis
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
AI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in Michelangelo
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
AI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning FrameworkAI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning Framework
 
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfA Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 

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