SlideShare a Scribd company logo
1 of 19
Download to read offline
UI Testing in Xcode 7
@roland9
roland@kitmanlabs.com
Xcake Dublin, 13th October 2015
UI Testing
• Find UI elements
• Interact with the app the same way as user does
• Validate changes through assertions
Why would I do it?
XCTest
• Xcode’s testing framework
• Apple introduced it in Xcode 5 - keeps adding:
• Unit Tests
• Performance Tests
• UI Tests
• Supports Objective-C and Swift
How does it work?
• New target type
• Executed in separate process
• New:
• XCUIApplication: proxy for tested app
• XCUIElement: proxy for elements
• XCUIElementQuery: resolves to collections of
elements
Documentation
http://masilotti.com/xctest-documentation
Demo
• Using Shwopping http://shwopping.herokuapp.com
• Test target for UI Test
• Recording (new test; but also enhance existing test)
• Manually add assertions
• Debugging:
• print how query gets resolved:
• p print(XCUIApplication().tables.cells.textFields.debugDescription)
• Accessibility Inspector ⌘F7: highlight button, …
• Screenshot - quick look
• Code coverage
Queries - Filtering
• Filter by Element type (button, table, …)
• Filter by Identifier (label, title, …)
• Predicates (value, partial matching, …)
• Remember: Queries can be chained
Queries - Details
• Find your UI elements by combining
Relationships and Filtering
• Use .element property to get XCUIElement
• Elements must be unique (use .exist to check
whether elements exists)
• Queries are evaluated on demand; will be re-
evaluated when UI changes
Example
let app = XCUIApplication()
let table = app.tables["Shopping List"]
app.launch()
XCTAssert(table.cells.count == 4, "wrong number of
cells")
table.cells.elementBoundByIndex(0).tap()
app.buttons["Clear text"].tap()
table.cells.elementBoundByIndex(0).textFields.elem
entBoundByIndex(0).typeText("xcake")
table.swipeDown()
Wait for Element
Comparison Calabash
Calabash
• Adds server to your
iOS app
• View hierarchy is
exposed and events
are generated
• API, DSL (Ruby) for
writing tests
Xcode 7
• App runs in separate process
• UI elements & queries (relationship
& filtering); assert values
• Events are synthesised on low level
of OS
• Integrated into Xcode (test target,
recording, code completion, running
tests, code coverage)
Pros / Cons: Xcode 7
• Nice: fully integrated into Xcode (debugging,
code coverage, …)
• Access to advanced scenarios: pickers, tap links
in a webView, reordering of table cells
• Backgrounding / foregrounding -> test app
lifecycle
• Not really expressive: similar to writing unit tests
with Kiwi / Spectra vs. XCTest
Pros / Cons: Calabash
• More expressive - you write tests in DSL
• More flexible (e.g. backdoor feature; get view
hierarchy)
• But NOT integrated…
• Similar to Xcode view debugging & Reveal.app:
• Xcode has superior integration (auto layout)
• but Reveal has great features
References
• WWDC https://developer.apple.com/videos/play/wwdc2015-406
• Xcake Calabash http://www.slideshare.net/roland99/ios-and-
android-acceptance-testing-with-calabash-xcake-dublin
• Automate https://krausefx.com/blog/run-xcode-7-ui-tests-from-
the-command-line
• Documentation http://masilotti.com/xctest-documentation
• Tips & Tricks http://masilotti.com/ui-testing-cheat-sheet
• App I used for demo: http://shwopping.herokuapp.com
Summary
• Recording is huge, but not perfect -> use it to learn
how to write tests
• Queries are evaluated on demand -> keep it DRY
• Relationships & filtering -> chain
• Integration into Xcode: code coverage, performance
testing, screenshots
UI Testing in Xcode 7
@roland9
roland@kitmanlabs.com
Xcake Dublin, 13th October 2015

More Related Content

What's hot

iOS Automation: XCUITest + Gherkin
iOS Automation: XCUITest + GherkiniOS Automation: XCUITest + Gherkin
iOS Automation: XCUITest + GherkinKenneth Poon
 
SwtBot: Unit Testing Made Easy
SwtBot: Unit Testing Made EasySwtBot: Unit Testing Made Easy
SwtBot: Unit Testing Made EasyAnkit Goel
 
UI Testing with Earl Grey
UI Testing with Earl GreyUI Testing with Earl Grey
UI Testing with Earl GreyShyam Bhat
 
Functional Testing made easy with SWTBot for Developers and Testers
Functional Testing made easy with SWTBot for Developers and TestersFunctional Testing made easy with SWTBot for Developers and Testers
Functional Testing made easy with SWTBot for Developers and TestersAurélien Pupier
 
[XCode] Automating UI Testing
[XCode] Automating UI Testing[XCode] Automating UI Testing
[XCode] Automating UI TestingPhineas Huang
 
WinAppDriver - Windows Store Apps Test Automation
WinAppDriver - Windows Store Apps Test AutomationWinAppDriver - Windows Store Apps Test Automation
WinAppDriver - Windows Store Apps Test AutomationJeremy Kao
 
Developing Java SWT Applications - A Starter
Developing Java SWT Applications - A StarterDeveloping Java SWT Applications - A Starter
Developing Java SWT Applications - A Startervcaselli
 
Automated UI testing done right (DDDSydney)
Automated UI testing done right (DDDSydney)Automated UI testing done right (DDDSydney)
Automated UI testing done right (DDDSydney)Mehdi Khalili
 
Automating UI testing
Automating UI testingAutomating UI testing
Automating UI testingAdam Siton
 
WinAppDriver Development
WinAppDriver DevelopmentWinAppDriver Development
WinAppDriver DevelopmentJeremy Kao
 
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016Codemotion
 
Client-side JavaScript
Client-side JavaScriptClient-side JavaScript
Client-side JavaScriptLilia Sfaxi
 
ATAGTR2017 Upgrading a mobile tester's weapons with advanced debugging
ATAGTR2017 Upgrading a mobile tester's weapons with advanced debuggingATAGTR2017 Upgrading a mobile tester's weapons with advanced debugging
ATAGTR2017 Upgrading a mobile tester's weapons with advanced debuggingAgile Testing Alliance
 
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 JourneyOren Farhi
 
Android UI Testing with Espresso
Android UI Testing with EspressoAndroid UI Testing with Espresso
Android UI Testing with EspressoGary Cheng
 

What's hot (19)

iOS Automation: XCUITest + Gherkin
iOS Automation: XCUITest + GherkiniOS Automation: XCUITest + Gherkin
iOS Automation: XCUITest + Gherkin
 
SwtBot: Unit Testing Made Easy
SwtBot: Unit Testing Made EasySwtBot: Unit Testing Made Easy
SwtBot: Unit Testing Made Easy
 
UI Testing with Earl Grey
UI Testing with Earl GreyUI Testing with Earl Grey
UI Testing with Earl Grey
 
Functional Testing made easy with SWTBot for Developers and Testers
Functional Testing made easy with SWTBot for Developers and TestersFunctional Testing made easy with SWTBot for Developers and Testers
Functional Testing made easy with SWTBot for Developers and Testers
 
6 swt programming
6 swt programming6 swt programming
6 swt programming
 
UI testing in Xcode 7
UI testing in Xcode 7UI testing in Xcode 7
UI testing in Xcode 7
 
[XCode] Automating UI Testing
[XCode] Automating UI Testing[XCode] Automating UI Testing
[XCode] Automating UI Testing
 
WinAppDriver - Windows Store Apps Test Automation
WinAppDriver - Windows Store Apps Test AutomationWinAppDriver - Windows Store Apps Test Automation
WinAppDriver - Windows Store Apps Test Automation
 
Developing Java SWT Applications - A Starter
Developing Java SWT Applications - A StarterDeveloping Java SWT Applications - A Starter
Developing Java SWT Applications - A Starter
 
Automated UI testing done right (DDDSydney)
Automated UI testing done right (DDDSydney)Automated UI testing done right (DDDSydney)
Automated UI testing done right (DDDSydney)
 
Automating UI testing
Automating UI testingAutomating UI testing
Automating UI testing
 
WinAppDriver Development
WinAppDriver DevelopmentWinAppDriver Development
WinAppDriver Development
 
Android Test Automation Workshop
Android Test Automation WorkshopAndroid Test Automation Workshop
Android Test Automation Workshop
 
Selenium Overview
Selenium OverviewSelenium Overview
Selenium Overview
 
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
 
Client-side JavaScript
Client-side JavaScriptClient-side JavaScript
Client-side JavaScript
 
ATAGTR2017 Upgrading a mobile tester's weapons with advanced debugging
ATAGTR2017 Upgrading a mobile tester's weapons with advanced debuggingATAGTR2017 Upgrading a mobile tester's weapons with advanced debugging
ATAGTR2017 Upgrading a mobile tester's weapons with advanced debugging
 
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
 
Android UI Testing with Espresso
Android UI Testing with EspressoAndroid UI Testing with Espresso
Android UI Testing with Espresso
 

Similar to Xcode 7 UI Testing - Xcake Dublin, October 2015

[Srijan Wednesday Webinar] Mastering Mobile Test Automation with Appium
[Srijan Wednesday Webinar] Mastering Mobile Test Automation with Appium[Srijan Wednesday Webinar] Mastering Mobile Test Automation with Appium
[Srijan Wednesday Webinar] Mastering Mobile Test Automation with AppiumSrijan Technologies
 
Ios driver presentation copy
Ios driver presentation copyIos driver presentation copy
Ios driver presentation copyDavid O'Dowd
 
How to build a JavaScript toolkit
How to build a JavaScript toolkitHow to build a JavaScript toolkit
How to build a JavaScript toolkitMichael Nelson
 
Xamarin.Forms Bootcamp
Xamarin.Forms BootcampXamarin.Forms Bootcamp
Xamarin.Forms BootcampMike Melusky
 
Automated Testing and Continuous Deployment for Mobile Apps with Jenkins
Automated Testing and Continuous Deployment for Mobile Apps with Jenkins Automated Testing and Continuous Deployment for Mobile Apps with Jenkins
Automated Testing and Continuous Deployment for Mobile Apps with Jenkins CloudBees
 
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014Phil Leggetter
 
Apex world 2018 continuously delivering APEX
Apex world 2018 continuously delivering APEXApex world 2018 continuously delivering APEX
Apex world 2018 continuously delivering APEXSergei Martens
 
Hudson
HudsonHudson
Hudson8x8
 
Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...
Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...
Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...seleniumconf
 
A tale of two pizzas: Developer tools at AWS
A tale of two pizzas: Developer tools at AWSA tale of two pizzas: Developer tools at AWS
A tale of two pizzas: Developer tools at AWSAmazon Web Services
 
Manage your external libraries with CocoaPods
Manage your external libraries with CocoaPodsManage your external libraries with CocoaPods
Manage your external libraries with CocoaPodsJuan C Catalan
 
ProtractorJS for automated testing of Angular 1.x/2.x applications
ProtractorJS for automated testing of Angular 1.x/2.x applicationsProtractorJS for automated testing of Angular 1.x/2.x applications
ProtractorJS for automated testing of Angular 1.x/2.x applicationsBinary Studio
 
No Container: a Modern Java Stack with Bootique
No Container: a Modern Java Stack with BootiqueNo Container: a Modern Java Stack with Bootique
No Container: a Modern Java Stack with BootiqueAndrus Adamchik
 
Continuous integration by Rémy Virin
Continuous integration by Rémy VirinContinuous integration by Rémy Virin
Continuous integration by Rémy VirinCocoaHeads France
 
Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для...
Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для...Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для...
Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для...Dakiry
 
QA Fes 2016. Александр Хотемской. Обзор ProtractorJS как фреймворка для брауз...
QA Fes 2016. Александр Хотемской. Обзор ProtractorJS как фреймворка для брауз...QA Fes 2016. Александр Хотемской. Обзор ProtractorJS как фреймворка для брауз...
QA Fes 2016. Александр Хотемской. Обзор ProtractorJS как фреймворка для брауз...QAFest
 
Announcing AWS CodeBuild - January 2017 Online Teck Talks
Announcing AWS CodeBuild - January 2017 Online Teck TalksAnnouncing AWS CodeBuild - January 2017 Online Teck Talks
Announcing AWS CodeBuild - January 2017 Online Teck TalksAmazon Web Services
 
WebObjects Developer Tools
WebObjects Developer ToolsWebObjects Developer Tools
WebObjects Developer ToolsWO Community
 

Similar to Xcode 7 UI Testing - Xcake Dublin, October 2015 (20)

[Srijan Wednesday Webinar] Mastering Mobile Test Automation with Appium
[Srijan Wednesday Webinar] Mastering Mobile Test Automation with Appium[Srijan Wednesday Webinar] Mastering Mobile Test Automation with Appium
[Srijan Wednesday Webinar] Mastering Mobile Test Automation with Appium
 
Ios driver presentation copy
Ios driver presentation copyIos driver presentation copy
Ios driver presentation copy
 
How to build a JavaScript toolkit
How to build a JavaScript toolkitHow to build a JavaScript toolkit
How to build a JavaScript toolkit
 
Xamarin.Forms Bootcamp
Xamarin.Forms BootcampXamarin.Forms Bootcamp
Xamarin.Forms Bootcamp
 
Automated Testing and Continuous Deployment for Mobile Apps with Jenkins
Automated Testing and Continuous Deployment for Mobile Apps with Jenkins Automated Testing and Continuous Deployment for Mobile Apps with Jenkins
Automated Testing and Continuous Deployment for Mobile Apps with Jenkins
 
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
 
Apex world 2018 continuously delivering APEX
Apex world 2018 continuously delivering APEXApex world 2018 continuously delivering APEX
Apex world 2018 continuously delivering APEX
 
Hudson
HudsonHudson
Hudson
 
Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...
Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...
Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...
 
A tale of two pizzas: Developer tools at AWS
A tale of two pizzas: Developer tools at AWSA tale of two pizzas: Developer tools at AWS
A tale of two pizzas: Developer tools at AWS
 
Manage your external libraries with CocoaPods
Manage your external libraries with CocoaPodsManage your external libraries with CocoaPods
Manage your external libraries with CocoaPods
 
Protractor survival guide
Protractor survival guideProtractor survival guide
Protractor survival guide
 
ProtractorJS for automated testing of Angular 1.x/2.x applications
ProtractorJS for automated testing of Angular 1.x/2.x applicationsProtractorJS for automated testing of Angular 1.x/2.x applications
ProtractorJS for automated testing of Angular 1.x/2.x applications
 
Automated Testing in DevOps
Automated Testing in DevOpsAutomated Testing in DevOps
Automated Testing in DevOps
 
No Container: a Modern Java Stack with Bootique
No Container: a Modern Java Stack with BootiqueNo Container: a Modern Java Stack with Bootique
No Container: a Modern Java Stack with Bootique
 
Continuous integration by Rémy Virin
Continuous integration by Rémy VirinContinuous integration by Rémy Virin
Continuous integration by Rémy Virin
 
Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для...
Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для...Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для...
Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для...
 
QA Fes 2016. Александр Хотемской. Обзор ProtractorJS как фреймворка для брауз...
QA Fes 2016. Александр Хотемской. Обзор ProtractorJS как фреймворка для брауз...QA Fes 2016. Александр Хотемской. Обзор ProtractorJS как фреймворка для брауз...
QA Fes 2016. Александр Хотемской. Обзор ProtractorJS как фреймворка для брауз...
 
Announcing AWS CodeBuild - January 2017 Online Teck Talks
Announcing AWS CodeBuild - January 2017 Online Teck TalksAnnouncing AWS CodeBuild - January 2017 Online Teck Talks
Announcing AWS CodeBuild - January 2017 Online Teck Talks
 
WebObjects Developer Tools
WebObjects Developer ToolsWebObjects Developer Tools
WebObjects Developer Tools
 

Recently uploaded

Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 

Recently uploaded (20)

Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 

Xcode 7 UI Testing - Xcake Dublin, October 2015

  • 1. UI Testing in Xcode 7 @roland9 roland@kitmanlabs.com Xcake Dublin, 13th October 2015
  • 2. UI Testing • Find UI elements • Interact with the app the same way as user does • Validate changes through assertions
  • 3. Why would I do it?
  • 4. XCTest • Xcode’s testing framework • Apple introduced it in Xcode 5 - keeps adding: • Unit Tests • Performance Tests • UI Tests • Supports Objective-C and Swift
  • 5. How does it work? • New target type • Executed in separate process • New: • XCUIApplication: proxy for tested app • XCUIElement: proxy for elements • XCUIElementQuery: resolves to collections of elements
  • 7.
  • 8. Demo • Using Shwopping http://shwopping.herokuapp.com • Test target for UI Test • Recording (new test; but also enhance existing test) • Manually add assertions • Debugging: • print how query gets resolved: • p print(XCUIApplication().tables.cells.textFields.debugDescription) • Accessibility Inspector ⌘F7: highlight button, … • Screenshot - quick look • Code coverage
  • 9. Queries - Filtering • Filter by Element type (button, table, …) • Filter by Identifier (label, title, …) • Predicates (value, partial matching, …) • Remember: Queries can be chained
  • 10. Queries - Details • Find your UI elements by combining Relationships and Filtering • Use .element property to get XCUIElement • Elements must be unique (use .exist to check whether elements exists) • Queries are evaluated on demand; will be re- evaluated when UI changes
  • 11. Example let app = XCUIApplication() let table = app.tables["Shopping List"] app.launch() XCTAssert(table.cells.count == 4, "wrong number of cells") table.cells.elementBoundByIndex(0).tap() app.buttons["Clear text"].tap() table.cells.elementBoundByIndex(0).textFields.elem entBoundByIndex(0).typeText("xcake") table.swipeDown()
  • 13. Comparison Calabash Calabash • Adds server to your iOS app • View hierarchy is exposed and events are generated • API, DSL (Ruby) for writing tests Xcode 7 • App runs in separate process • UI elements & queries (relationship & filtering); assert values • Events are synthesised on low level of OS • Integrated into Xcode (test target, recording, code completion, running tests, code coverage)
  • 14. Pros / Cons: Xcode 7 • Nice: fully integrated into Xcode (debugging, code coverage, …) • Access to advanced scenarios: pickers, tap links in a webView, reordering of table cells • Backgrounding / foregrounding -> test app lifecycle • Not really expressive: similar to writing unit tests with Kiwi / Spectra vs. XCTest
  • 15. Pros / Cons: Calabash • More expressive - you write tests in DSL • More flexible (e.g. backdoor feature; get view hierarchy) • But NOT integrated… • Similar to Xcode view debugging & Reveal.app: • Xcode has superior integration (auto layout) • but Reveal has great features
  • 16. References • WWDC https://developer.apple.com/videos/play/wwdc2015-406 • Xcake Calabash http://www.slideshare.net/roland99/ios-and- android-acceptance-testing-with-calabash-xcake-dublin • Automate https://krausefx.com/blog/run-xcode-7-ui-tests-from- the-command-line • Documentation http://masilotti.com/xctest-documentation • Tips & Tricks http://masilotti.com/ui-testing-cheat-sheet • App I used for demo: http://shwopping.herokuapp.com
  • 17. Summary • Recording is huge, but not perfect -> use it to learn how to write tests • Queries are evaluated on demand -> keep it DRY • Relationships & filtering -> chain • Integration into Xcode: code coverage, performance testing, screenshots
  • 18.
  • 19. UI Testing in Xcode 7 @roland9 roland@kitmanlabs.com Xcake Dublin, 13th October 2015