SlideShare une entreprise Scribd logo
1  sur  31
Télécharger pour lire hors ligne
UI TESTING WITH
EARL GREY
SHYAM BHAT
swift.berlin
TESTING MOBILE APPS
APPS ARE GETTING COMPLEX
TESTING IS ESSENTIAL FOR
GREAT QUALITY
TESTING INFLUENCES GOOD
ARCHITECTURE
TESTING IMPROVES CODE
READABILITY
PROGRAMS MUST BE WRITTEN FOR
PEOPLE TO READ, AND ONLY
INCIDENTALLY FOR MACHINES TO
EXECUTE.
Harold Abelson
UI TESTS ARE ESSENTIAL
▸ Germany’s leading digital
real estate marketplace.
▸ Over 12 million App
downloads.
▸ Swift + Objective C
OUR TEST SUITE
▸ XCTest + FBSnapshots for Unit testing
▸ Xcode UI Testing + KIF
▸ 3000+ Unit tests and Integration tests.
BUT…
UI TESTS ARE SLOW AND
COMPLEX TO WRITE
SYNCHRONIZING THE UI IS A
PAIN
RESULTS ARE INCONSISTENT
AND UNRELIABLE
MEET EARL GREY
EARL GREY IS AN UI AUTOMATION
TEST FRAMEWORK THAT ENABLES
YOU TO WRITE CLEAR, CONCISE
TESTS.
EARL GREY
▸ Google’s internal UI Testing framework.
▸ Used in YouTube, Google Calendar, Google Photos,
Google Translate, Google Play Music.
▸ Recently open sourced.
FEATURES
▸ Synchronization.
▸ User-like interactions (taps, swipes).
▸ Visibility checks before interactions.
▸ Extensible API - custom UI actions and assertions.
HOW EARL GREY WORKS
▸ EarlGrey runs in the same process as the app under test,
and has access to the same memory as the app.
▸ Uses private methods to learn view hierarchy and inject
touches.
▸ Works in conjunction with the XCTest framework.
EARL GREY API
▸ Interaction APIs
▸ Synchronization APIs
▸ Other Top Level APIs
INTERACTION APIS
▸ Selection API - Selecting an element to interact with.
▸ Action API - Performing an action on it,
▸ Assertion API - Making an assertion to verify state and
behavior.
SELECTION
▸ Format:
selectElementWithMatcher(<GREYMatcher>)
▸ GREYMatcher
grey_accessibilityID(“ClickMe”)
grey_accessibilityLabel(“Berlin")
grey_kindOfClass(UITableViewCell)
▸ Example:
// Select the button with Accessibility ID "clickMe".
EarlGrey().selectElementWithMatcher(grey_accessibilityID("ClickMe"))
SELECTION
▸ A GREYMatcher compliant object can be ambiguous and match
multiple elements.
▸ Must be narrowed down until a single element is identified.
▸ You can combine multiple GREYMatchers using -
grey_allOf()
grey_anyOf()
grey_not()
▸ Example:
let sendButtonMatcher : <GREYMatcher> =
grey_allOf(grey_accessibilityLabel("Send"), grey_sufficientlyVisible(), nil)
EarlGrey().selectElementWithMatcher(sendButtonMatcher)
ACTION
▸ Format:
selectElementWithMatcher(<GREYMatcher>).performAction(<GREYAction>)
▸ <GREYAction>
grey_tap()
grey_longPress()
grey_tapAtPoint(CGPoint point)
grey_scrollInDirection(GREYDirection direction, CGFloat amount)
▸ Example:
// Select the button with Accessibility ID “clickMe" and perform Tap Action.
EarlGrey().selectElementWithMatcher(grey_accessibilityID(“ClickMe”)).
performAction(grey_tap())
ASSERTIONS
▸ Format:
selectElementWithMatcher(<GREYMatcher>).assertWithMatcher(<GREYAction>)
▸ Example:
// Select the button with Accessibility ID “ClickMe" and perform Tap Action.
EarlGrey().selectElementWithMatcher(grey_accessibilityID(“ClickMe”))
.assertWithMatcher(grey_sufficientlyVisible())
SEARCH FUNNEL TESTS
DEMO :
OTHER API
▸ Custom Assertions and Matchers
▸ Failure Handlers
▸ Synchronization API
▸ Layout Testing
KNOWN ISSUES
▸ Cannot interact with system dialogs (yet).
▸ No 3D Touch support.
REFERENCES
▸ Github Repository and API Documentation - https://
github.com/google/EarlGrey
▸ Google’s Developer blog - https://
developers.googleblog.com/2016/02/earlgrey-ios-
functional-ui-testing.html
THANKS!
QUESTIONS?
@bhatthead
github.com/shyambhat

Contenu connexe

Tendances

iOS Application Penetation Test
iOS Application Penetation TestiOS Application Penetation Test
iOS Application Penetation Test
JongWon Kim
 
Container Network Interface: Network Plugins for Kubernetes and beyond
Container Network Interface: Network Plugins for Kubernetes and beyondContainer Network Interface: Network Plugins for Kubernetes and beyond
Container Network Interface: Network Plugins for Kubernetes and beyond
KubeAcademy
 

Tendances (20)

Dockerで始める Java EE アプリケーション開発 for JJUG CCC 2017
Dockerで始める Java EE アプリケーション開発 for JJUG CCC 2017Dockerで始める Java EE アプリケーション開発 for JJUG CCC 2017
Dockerで始める Java EE アプリケーション開発 for JJUG CCC 2017
 
Icsm20.ppt
Icsm20.pptIcsm20.ppt
Icsm20.ppt
 
[OpenInfra Days Korea 2018] (Track 1) TACO (SKT All Container OpenStack): Clo...
[OpenInfra Days Korea 2018] (Track 1) TACO (SKT All Container OpenStack): Clo...[OpenInfra Days Korea 2018] (Track 1) TACO (SKT All Container OpenStack): Clo...
[OpenInfra Days Korea 2018] (Track 1) TACO (SKT All Container OpenStack): Clo...
 
Kubernetes #6 advanced scheduling
Kubernetes #6   advanced schedulingKubernetes #6   advanced scheduling
Kubernetes #6 advanced scheduling
 
iOS Application Penetation Test
iOS Application Penetation TestiOS Application Penetation Test
iOS Application Penetation Test
 
Starting up Containers Super Fast With Lazy Pulling of Images
Starting up Containers Super Fast With Lazy Pulling of ImagesStarting up Containers Super Fast With Lazy Pulling of Images
Starting up Containers Super Fast With Lazy Pulling of Images
 
Paper_Design of Swap-aware Java Virtual Machine Garbage Collector Policy
Paper_Design of Swap-aware Java Virtual Machine Garbage Collector PolicyPaper_Design of Swap-aware Java Virtual Machine Garbage Collector Policy
Paper_Design of Swap-aware Java Virtual Machine Garbage Collector Policy
 
Web Assembly (on the server)
Web Assembly (on the server)Web Assembly (on the server)
Web Assembly (on the server)
 
SonarQube와 함께하는 소프트웨어 품질 세미나 - SonarQube 소개
SonarQube와 함께하는 소프트웨어 품질 세미나 - SonarQube 소개SonarQube와 함께하는 소프트웨어 품질 세미나 - SonarQube 소개
SonarQube와 함께하는 소프트웨어 품질 세미나 - SonarQube 소개
 
Introduction to Red Hat OpenShift 4
Introduction to Red Hat OpenShift 4Introduction to Red Hat OpenShift 4
Introduction to Red Hat OpenShift 4
 
Draft: building secure applications with keycloak (oidc/jwt)
Draft: building secure applications with keycloak (oidc/jwt)Draft: building secure applications with keycloak (oidc/jwt)
Draft: building secure applications with keycloak (oidc/jwt)
 
카카오 전사 모니터링/로깅/알람플랫폼 KEMI
카카오 전사 모니터링/로깅/알람플랫폼 KEMI카카오 전사 모니터링/로깅/알람플랫폼 KEMI
카카오 전사 모니터링/로깅/알람플랫폼 KEMI
 
Container Network Interface: Network Plugins for Kubernetes and beyond
Container Network Interface: Network Plugins for Kubernetes and beyondContainer Network Interface: Network Plugins for Kubernetes and beyond
Container Network Interface: Network Plugins for Kubernetes and beyond
 
vitest-en.pdf
vitest-en.pdfvitest-en.pdf
vitest-en.pdf
 
Ionic in 30
Ionic in 30Ionic in 30
Ionic in 30
 
Lightweight Zero-trust Network Implementation and Transition with Keycloak an...
Lightweight Zero-trust Network Implementation and Transition with Keycloak an...Lightweight Zero-trust Network Implementation and Transition with Keycloak an...
Lightweight Zero-trust Network Implementation and Transition with Keycloak an...
 
La sécurité des applications avec ESAPI
La sécurité des applications avec ESAPILa sécurité des applications avec ESAPI
La sécurité des applications avec ESAPI
 
DSC IIITL Flutter Workshop
DSC IIITL Flutter WorkshopDSC IIITL Flutter Workshop
DSC IIITL Flutter Workshop
 
MobSF: Mobile Security Testing (Android/IoS)
MobSF: Mobile Security Testing (Android/IoS)MobSF: Mobile Security Testing (Android/IoS)
MobSF: Mobile Security Testing (Android/IoS)
 
WUG Days 2022 Brno - Networking in .NET 7.0 and YARP -- Karel Zikmund
WUG Days 2022 Brno - Networking in .NET 7.0 and YARP -- Karel ZikmundWUG Days 2022 Brno - Networking in .NET 7.0 and YARP -- Karel Zikmund
WUG Days 2022 Brno - Networking in .NET 7.0 and YARP -- Karel Zikmund
 

En vedette

Unit testing in iOS featuring OCUnit, GHUnit & OCMock
Unit testing in iOS featuring OCUnit, GHUnit & OCMockUnit testing in iOS featuring OCUnit, GHUnit & OCMock
Unit testing in iOS featuring OCUnit, GHUnit & OCMock
Robot Media
 

En vedette (20)

Keep it calm and functional. Автотесты для iOS приложений
Keep it calm and functional. Автотесты для iOS приложенийKeep it calm and functional. Автотесты для iOS приложений
Keep it calm and functional. Автотесты для iOS приложений
 
iOS Automation Frameworks evaluation
iOS Automation Frameworks evaluationiOS Automation Frameworks evaluation
iOS Automation Frameworks evaluation
 
Ios ui automation test framework
Ios ui automation test frameworkIos ui automation test framework
Ios ui automation test framework
 
Making Swift even safer
Making Swift even saferMaking Swift even safer
Making Swift even safer
 
Unit testing in iOS featuring OCUnit, GHUnit & OCMock
Unit testing in iOS featuring OCUnit, GHUnit & OCMockUnit testing in iOS featuring OCUnit, GHUnit & OCMock
Unit testing in iOS featuring OCUnit, GHUnit & OCMock
 
Page Object in XCUITest
Page Object in XCUITestPage Object in XCUITest
Page Object in XCUITest
 
iOS Automation: XCUITest + Gherkin
iOS Automation: XCUITest + GherkiniOS Automation: XCUITest + Gherkin
iOS Automation: XCUITest + Gherkin
 
UX Design Testing Battle School - ISL
UX Design Testing Battle School - ISLUX Design Testing Battle School - ISL
UX Design Testing Battle School - ISL
 
Json vs Gson vs Jackson
Json vs Gson vs JacksonJson vs Gson vs Jackson
Json vs Gson vs Jackson
 
Ui BDD Testing
Ui BDD TestingUi BDD Testing
Ui BDD Testing
 
Responsive Web Design testing using Galen Framework
Responsive Web Design testing using Galen FrameworkResponsive Web Design testing using Galen Framework
Responsive Web Design testing using Galen Framework
 
Try EarlGrey | 20161118 iOS Test Night
Try EarlGrey | 20161118 iOS Test NightTry EarlGrey | 20161118 iOS Test Night
Try EarlGrey | 20161118 iOS Test Night
 
Качества хорошего тест-лида
Качества хорошего тест-лидаКачества хорошего тест-лида
Качества хорошего тест-лида
 
Writing Swift code with great testability
Writing Swift code with great testabilityWriting Swift code with great testability
Writing Swift code with great testability
 
Xcodeの管理を楽に - Jenkins編 -
Xcodeの管理を楽に - Jenkins編 -Xcodeの管理を楽に - Jenkins編 -
Xcodeの管理を楽に - Jenkins編 -
 
iOSアプリの自動テストをはじめよう
iOSアプリの自動テストをはじめようiOSアプリの自動テストをはじめよう
iOSアプリの自動テストをはじめよう
 
Report Portal - эффективность вашей автоматизации
Report Portal - эффективность вашей автоматизацииReport Portal - эффективность вашей автоматизации
Report Portal - эффективность вашей автоматизации
 
UI Testing Best Practices - An Expected Journey
UI Testing Best Practices - An Expected JourneyUI Testing Best Practices - An Expected Journey
UI Testing Best Practices - An Expected Journey
 
Грабли тестировщика
Грабли тестировщикаГрабли тестировщика
Грабли тестировщика
 
MonkeyTalk Automation Testing For Android Application
MonkeyTalk Automation Testing For Android ApplicationMonkeyTalk Automation Testing For Android Application
MonkeyTalk Automation Testing For Android Application
 

Similaire à UI Testing with Earl Grey

Similaire à UI Testing with Earl Grey (20)

Xam expertday
Xam expertdayXam expertday
Xam expertday
 
Xamarin Test Cloud - from zero to hero in automated ui testing
Xamarin Test Cloud - from zero to hero in automated ui testingXamarin Test Cloud - from zero to hero in automated ui testing
Xamarin Test Cloud - from zero to hero in automated ui testing
 
Тестирование мобильных приложений используя облачные сервисы. TestDroid, Test...
Тестирование мобильных приложений используя облачные сервисы. TestDroid, Test...Тестирование мобильных приложений используя облачные сервисы. TestDroid, Test...
Тестирование мобильных приложений используя облачные сервисы. TestDroid, Test...
 
Device Testing with AWS Device Farm
Device Testing with AWS Device FarmDevice Testing with AWS Device Farm
Device Testing with AWS Device Farm
 
Device Testing with AWS Device Farm
Device Testing with AWS Device FarmDevice Testing with AWS Device Farm
Device Testing with AWS Device Farm
 
Introduction to AWS Device Farm
Introduction to AWS Device FarmIntroduction to AWS Device Farm
Introduction to AWS Device Farm
 
Testing Your App Before Launch: An Introduction to AWS Device Farm
Testing Your App Before Launch: An Introduction to AWS Device FarmTesting Your App Before Launch: An Introduction to AWS Device Farm
Testing Your App Before Launch: An Introduction to AWS Device Farm
 
How To Write a Symphony of Automation With Appium by Dan Cuellar sauce con18
How To Write a Symphony of Automation With Appium by Dan Cuellar sauce con18How To Write a Symphony of Automation With Appium by Dan Cuellar sauce con18
How To Write a Symphony of Automation With Appium by Dan Cuellar sauce con18
 
How To Write A Symphony of Automation With Appium
How To Write A Symphony of Automation With AppiumHow To Write A Symphony of Automation With Appium
How To Write A Symphony of Automation With Appium
 
Android Introduction Talk
Android Introduction TalkAndroid Introduction Talk
Android Introduction Talk
 
Mobile Quality Night Vienna 2015 - Testobject Appium in der Cloud
Mobile Quality Night Vienna 2015 - Testobject Appium in der CloudMobile Quality Night Vienna 2015 - Testobject Appium in der Cloud
Mobile Quality Night Vienna 2015 - Testobject Appium in der Cloud
 
Appium overview
Appium overviewAppium overview
Appium overview
 
Selenium Testing Training in Bangalore
Selenium Testing Training in BangaloreSelenium Testing Training in Bangalore
Selenium Testing Training in Bangalore
 
Visual Studio 2017 Launch Event
Visual Studio 2017 Launch EventVisual Studio 2017 Launch Event
Visual Studio 2017 Launch Event
 
Tips & tricks for sharing C# code on iOS, Android and Windows Phone by Jaime ...
Tips & tricks for sharing C# code on iOS, Android and Windows Phone by Jaime ...Tips & tricks for sharing C# code on iOS, Android and Windows Phone by Jaime ...
Tips & tricks for sharing C# code on iOS, Android and Windows Phone by Jaime ...
 
Android Evolution, AppForum 2014, Brussels, Friedger Müffke
Android Evolution, AppForum 2014, Brussels, Friedger MüffkeAndroid Evolution, AppForum 2014, Brussels, Friedger Müffke
Android Evolution, AppForum 2014, Brussels, Friedger Müffke
 
Automated Testing in Angular Slides
Automated Testing in Angular SlidesAutomated Testing in Angular Slides
Automated Testing in Angular Slides
 
Demystify Accessibility
Demystify AccessibilityDemystify Accessibility
Demystify Accessibility
 
Hieu Xamarin iOS9, Android M 3-11-2015
Hieu Xamarin iOS9, Android M  3-11-2015Hieu Xamarin iOS9, Android M  3-11-2015
Hieu Xamarin iOS9, Android M 3-11-2015
 
Write once, ship multiple times
Write once, ship multiple timesWrite once, ship multiple times
Write once, ship multiple times
 

Dernier

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Dernier (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

UI Testing with Earl Grey