SlideShare a Scribd company logo
Automated Xcode 7
UI Testing
HelsinkiOS 26 August 2015
Xcode 7 Features
— Testability. Write tests of Swift 2.0 frameworks and apps
with access to all your public and internal routines
— User interface testing and recording. Test applications
at the user interface surface with elements, queries, and
simulated events. The UI recording feature enables
capture of UI actions into source to facilitate creating
tests (DEMO)
— App thinning (iOS 9 SDK), Xcode bots + OS X Server
with on demand resources (ou-es ten server)
Xcode 7 Features (cont)
— Free Provisioning. Develop on your own device,
mechanism to provision and install development
project on physical devices for testing and
evaluation.
— Code coverage. Provides report information to
evaluate a test suite for completeness.
Code Coverage
— Visualize the completeness of your test suite by
enabling code coverage for your scheme. The code
coverage tab in the test report shows which files,
functions and lines of code were exercised and, more
importantly, which were not exercised. The source
code editor can also show code coverage information
inline, allowing you to see at a glance which lines—
and parts of a line—the tests exercised. (3555436)
Automated Xcode 7 UI Testing
Beta 4
— Using UI recording generates code for iOS gestures
like doubleTap, twoFingerTap, longPress, swipeUp,
swipeDown, swipeLeft, and swipeRight. (20278248)
— Code coverage works with UI testing. (20966994)
Beta 5
— Code Coverage now supports files in static libraries.
The source files show up under each binary that links
the static library in the Coverage tab of the Test
Report. The source editor shows coverage numbers
aggregated across all binaries. (21984681)
Beta 6
— XCTest offers API to automate complex controls such as date
pickers. (20577276)
— Apps with names that contain parenthesis can be exported from
the Archives organizer. (22142125)
— Ability to interact with hardware buttons, like
XCUIDeviceButtonHome.
— Ability to interact with XCUIElementTypeSlider and
XCUIElementTypePickerWheel
— Ability to handle alerts that gets in the way with the new add/
removeUIInterruptionMonitor APIs
Known Problems (Beta 6)
— UI testing cannot identify elements using information from their
accessibility title element. Workaround: Set an accessibility
identifier instead. (20409319)
— UI testing cannot record or interact with popovers on OS X.
(21162677)
— UI tests do not support key modifiers on iOS. (20185910,
21033224)
— When recording a UI Test for an OS X app, Xcode Helper, not
Xcode, asks to use the Accessibility APIs. This app uses the
Accessibility APIs when running UI Tests. (21211897)
Syntax -XCUIApplication
— Proxy to application, separate from app (runs in
separate process)
— Can control when to launch or terminate app
app.launchEnvironment = ["myValue": "value"]
app.launch()
if let value = NSProcessInfo.processInfo().environment["myValue"]
{
// do something with value
}
Syntax -XCUIElement
— Application is a tree of elements with hierarchy
(think DOM tree)
— Element must be unique
— Based on UIControl (button, table cell, window)
— Accessibility identifier, label, title, etc.
— Custom element visibility e.g. via Interface Builder
Accessibility Inspector
Syntax -XCUIElementQuery
— Must resolve to single element, otherwise failure
— Evaluated on-demand and re-evaluated when used
(think URL lifecycle)
— "exists" property can be used to safely test elements
— Elements visible via accessibility
— Relationships and filtering
— Chain queries
Syntax -XCTest Assertions 1
XCTAssert(expression, format...)
XCTAssertTrue(expression, format...)
XCTAssertFalse(expression, format...)
XCTAssertEqual(expression1, expression2, format...)
XCTAssertNotEqual(expression1, expression2, format...)
XCTAssertEqualWithAccuracy(expression1, expression2, accuracy, format...)
XCTAssertNotEqualWithAccuracy(expression1, expression2, accuracy, format...)
XCTAssertNil(expression, format...)
XCTAssertNotNil(expression, format...)
XCTAssertNil(expression, format...)
XCTAssertNotNil(expression, format...)
1
XCTestCase / XCTestExpectation / measureBlock() at NSHipster
Debug
— Use breakpoints in test cases
— Same familiar LLDB debugger and commands 2
— Test reports at Xcode Report Navigator
— Automatic screenshots
— Just re-record test cases, it's that easy !!!
2
About LLDB and Xcode by Apple
Demo...awesome !!! Just look at that dynamic realtime code
refactoring, when recording test cases O_O
More info
— Xcode 7 Beta 6 Release Notes
— WWDC 2015 video + PDF 406: UI Testing in Xcode
— WWDC 2015 video + PDF 410: Continuous Integration and
Code Coverage in Xcode
— WWDC 2014 video + PDF 415: Continuous Integration with
Xcode 6
— XCTest and UI Testing documentation by Joe Maselotti
— XCTestCase / XCTestExpectation / measureBlock() at NSHipster
— UIAccessibility documentation by Apple
Thank You!
Any questions? SlideShare.
Jouni Miettunen - jouni.miettunen@gmail.com
@jomtwi
at Elisa Software Services, looking for mobile
developers
Ad

More Related Content

What's hot (20)

SWTBot Tutorial
SWTBot TutorialSWTBot Tutorial
SWTBot Tutorial
Chris Aniszczyk
 
SwtBot: Unit Testing Made Easy
SwtBot: Unit Testing Made EasySwtBot: Unit Testing Made Easy
SwtBot: Unit Testing Made Easy
Ankit Goel
 
Swtbot
SwtbotSwtbot
Swtbot
cristitep
 
UI testing in Xcode 7
UI testing in Xcode 7UI testing in Xcode 7
UI testing in Xcode 7
Dominique Stranz
 
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
Aurélien Pupier
 
iOS UI Automation
iOS UI AutomationiOS UI Automation
iOS UI Automation
Greener Chen
 
Taras Kalapun ui testing
Taras Kalapun ui testingTaras Kalapun ui testing
Taras Kalapun ui testing
DneprCiklumEvents
 
JsUnit
JsUnitJsUnit
JsUnit
Alex Chaffee
 
Android UI Testing with Espresso
Android UI Testing with EspressoAndroid UI Testing with Espresso
Android UI Testing with Espresso
Gary Cheng
 
Client-side JavaScript
Client-side JavaScriptClient-side JavaScript
Client-side JavaScript
Lilia Sfaxi
 
Developing Java SWT Applications - A Starter
Developing Java SWT Applications - A StarterDeveloping Java SWT Applications - A Starter
Developing Java SWT Applications - A Starter
vcaselli
 
Writing and Testing JavaScript-heavy Web 2.0 apps with JSUnit
Writing and Testing JavaScript-heavy Web 2.0 apps with JSUnitWriting and Testing JavaScript-heavy Web 2.0 apps with JSUnit
Writing and Testing JavaScript-heavy Web 2.0 apps with JSUnit
Alex Chaffee
 
Deep Dive Modern Apps Lifecycle with Visual Studio 2012: How to create cross ...
Deep Dive Modern Apps Lifecycle with Visual Studio 2012: How to create cross ...Deep Dive Modern Apps Lifecycle with Visual Studio 2012: How to create cross ...
Deep Dive Modern Apps Lifecycle with Visual Studio 2012: How to create cross ...
Microsoft Developer Network (MSDN) - Belgium and Luxembourg
 
Steps how to create active x using visual studio 2008
Steps how to create active x using visual studio 2008Steps how to create active x using visual studio 2008
Steps how to create active x using visual studio 2008
Yudep Apoi
 
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
Oren Farhi
 
Top 3 SWT Exceptions
Top 3 SWT ExceptionsTop 3 SWT Exceptions
Top 3 SWT Exceptions
Lakshmi Priya
 
Lightning Talk - iOS UI Automated Testing
Lightning Talk - iOS UI Automated TestingLightning Talk - iOS UI Automated Testing
Lightning Talk - iOS UI Automated Testing
Rafael Sperling
 
WinAppDriver - Windows Store Apps Test Automation
WinAppDriver - Windows Store Apps Test AutomationWinAppDriver - Windows Store Apps Test Automation
WinAppDriver - Windows Store Apps Test Automation
Jeremy Kao
 
Feedback using Angularjs + Typescript at Serenytics
Feedback using Angularjs +  Typescript at SerenyticsFeedback using Angularjs +  Typescript at Serenytics
Feedback using Angularjs + Typescript at Serenytics
Adrien Chauve
 
Tellurium 0.7.0 presentation
Tellurium 0.7.0 presentationTellurium 0.7.0 presentation
Tellurium 0.7.0 presentation
John.Jian.Fang
 
SwtBot: Unit Testing Made Easy
SwtBot: Unit Testing Made EasySwtBot: Unit Testing Made Easy
SwtBot: Unit Testing Made Easy
Ankit Goel
 
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
Aurélien Pupier
 
Android UI Testing with Espresso
Android UI Testing with EspressoAndroid UI Testing with Espresso
Android UI Testing with Espresso
Gary Cheng
 
Client-side JavaScript
Client-side JavaScriptClient-side JavaScript
Client-side JavaScript
Lilia Sfaxi
 
Developing Java SWT Applications - A Starter
Developing Java SWT Applications - A StarterDeveloping Java SWT Applications - A Starter
Developing Java SWT Applications - A Starter
vcaselli
 
Writing and Testing JavaScript-heavy Web 2.0 apps with JSUnit
Writing and Testing JavaScript-heavy Web 2.0 apps with JSUnitWriting and Testing JavaScript-heavy Web 2.0 apps with JSUnit
Writing and Testing JavaScript-heavy Web 2.0 apps with JSUnit
Alex Chaffee
 
Steps how to create active x using visual studio 2008
Steps how to create active x using visual studio 2008Steps how to create active x using visual studio 2008
Steps how to create active x using visual studio 2008
Yudep Apoi
 
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
Oren Farhi
 
Top 3 SWT Exceptions
Top 3 SWT ExceptionsTop 3 SWT Exceptions
Top 3 SWT Exceptions
Lakshmi Priya
 
Lightning Talk - iOS UI Automated Testing
Lightning Talk - iOS UI Automated TestingLightning Talk - iOS UI Automated Testing
Lightning Talk - iOS UI Automated Testing
Rafael Sperling
 
WinAppDriver - Windows Store Apps Test Automation
WinAppDriver - Windows Store Apps Test AutomationWinAppDriver - Windows Store Apps Test Automation
WinAppDriver - Windows Store Apps Test Automation
Jeremy Kao
 
Feedback using Angularjs + Typescript at Serenytics
Feedback using Angularjs +  Typescript at SerenyticsFeedback using Angularjs +  Typescript at Serenytics
Feedback using Angularjs + Typescript at Serenytics
Adrien Chauve
 
Tellurium 0.7.0 presentation
Tellurium 0.7.0 presentationTellurium 0.7.0 presentation
Tellurium 0.7.0 presentation
John.Jian.Fang
 

Viewers also liked (6)

Page Object in XCUITest
Page Object in XCUITestPage Object in XCUITest
Page Object in XCUITest
Jz Chang
 
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
Bitbar
 
iOS Unit Testing
iOS Unit TestingiOS Unit Testing
iOS Unit Testing
sgleadow
 
[XCode] Automating UI Testing
[XCode] Automating UI Testing[XCode] Automating UI Testing
[XCode] Automating UI Testing
Phineas Huang
 
iOS Test-Driven Development
iOS Test-Driven DevelopmentiOS Test-Driven Development
iOS Test-Driven Development
Pablo Villar
 
Static Swift Code Analysis - The Background Story
Static Swift Code Analysis - The Background StoryStatic Swift Code Analysis - The Background Story
Static Swift Code Analysis - The Background Story
Jouni Miettunen
 
Page Object in XCUITest
Page Object in XCUITestPage Object in XCUITest
Page Object in XCUITest
Jz Chang
 
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
Bitbar
 
iOS Unit Testing
iOS Unit TestingiOS Unit Testing
iOS Unit Testing
sgleadow
 
[XCode] Automating UI Testing
[XCode] Automating UI Testing[XCode] Automating UI Testing
[XCode] Automating UI Testing
Phineas Huang
 
iOS Test-Driven Development
iOS Test-Driven DevelopmentiOS Test-Driven Development
iOS Test-Driven Development
Pablo Villar
 
Static Swift Code Analysis - The Background Story
Static Swift Code Analysis - The Background StoryStatic Swift Code Analysis - The Background Story
Static Swift Code Analysis - The Background Story
Jouni Miettunen
 
Ad

Similar to Automated Xcode 7 UI Testing (20)

Understanding XCUITest Framework Your Guide to Efficient iOS Testing.pdf
Understanding XCUITest Framework Your Guide to Efficient iOS Testing.pdfUnderstanding XCUITest Framework Your Guide to Efficient iOS Testing.pdf
Understanding XCUITest Framework Your Guide to Efficient iOS Testing.pdf
pCloudy
 
GUI design using JAVAFX.ppt
GUI design using JAVAFX.pptGUI design using JAVAFX.ppt
GUI design using JAVAFX.ppt
TabassumMaktum
 
UI Automation_White_CodedUI common problems and tricks
UI Automation_White_CodedUI common problems and tricksUI Automation_White_CodedUI common problems and tricks
UI Automation_White_CodedUI common problems and tricks
Tsimafei Avilin
 
Coded UI: Hand Coding based on Page Object Model
Coded UI: Hand Coding based on Page Object ModelCoded UI: Hand Coding based on Page Object Model
Coded UI: Hand Coding based on Page Object Model
Tharinda Liyanage
 
Stmik bandung
Stmik bandungStmik bandung
Stmik bandung
farid savarudin
 
Gui
GuiGui
Gui
Sardar Alam
 
Visual Studio commands
Visual Studio commandsVisual Studio commands
Visual Studio commands
PVS-Studio
 
Testing Tools
Testing ToolsTesting Tools
Testing Tools
Ted Husted
 
Selenium Testing Training in Bangalore
Selenium Testing Training in BangaloreSelenium Testing Training in Bangalore
Selenium Testing Training in Bangalore
rajkamal560066
 
System verilog important
System verilog importantSystem verilog important
System verilog important
elumalai7
 
Developing Interactive systems - lesson 2
Developing Interactive systems - lesson 2Developing Interactive systems - lesson 2
Developing Interactive systems - lesson 2
Sónia
 
open-west
open-westopen-west
open-west
Konnor Willison
 
automation framework
automation frameworkautomation framework
automation framework
ANSHU GOYAL
 
Swift
SwiftSwift
Swift
Larry Ball
 
Manageable Robust Automated Ui Test
Manageable Robust Automated Ui TestManageable Robust Automated Ui Test
Manageable Robust Automated Ui Test
John.Jian.Fang
 
Calabash-android
Calabash-androidCalabash-android
Calabash-android
Adnan8990
 
Test Complete
Test CompleteTest Complete
Test Complete
RomSoft SRL
 
Advanced Swift Generics
Advanced Swift GenericsAdvanced Swift Generics
Advanced Swift Generics
Max Sokolov
 
Automation strategies for agile testing Gaurav bansal
Automation strategies for agile testing  Gaurav bansalAutomation strategies for agile testing  Gaurav bansal
Automation strategies for agile testing Gaurav bansal
India Scrum Enthusiasts Community
 
Deeper into Windows 10 Development
Deeper into Windows 10 DevelopmentDeeper into Windows 10 Development
Deeper into Windows 10 Development
Shahed Chowdhuri
 
Understanding XCUITest Framework Your Guide to Efficient iOS Testing.pdf
Understanding XCUITest Framework Your Guide to Efficient iOS Testing.pdfUnderstanding XCUITest Framework Your Guide to Efficient iOS Testing.pdf
Understanding XCUITest Framework Your Guide to Efficient iOS Testing.pdf
pCloudy
 
GUI design using JAVAFX.ppt
GUI design using JAVAFX.pptGUI design using JAVAFX.ppt
GUI design using JAVAFX.ppt
TabassumMaktum
 
UI Automation_White_CodedUI common problems and tricks
UI Automation_White_CodedUI common problems and tricksUI Automation_White_CodedUI common problems and tricks
UI Automation_White_CodedUI common problems and tricks
Tsimafei Avilin
 
Coded UI: Hand Coding based on Page Object Model
Coded UI: Hand Coding based on Page Object ModelCoded UI: Hand Coding based on Page Object Model
Coded UI: Hand Coding based on Page Object Model
Tharinda Liyanage
 
Visual Studio commands
Visual Studio commandsVisual Studio commands
Visual Studio commands
PVS-Studio
 
Selenium Testing Training in Bangalore
Selenium Testing Training in BangaloreSelenium Testing Training in Bangalore
Selenium Testing Training in Bangalore
rajkamal560066
 
System verilog important
System verilog importantSystem verilog important
System verilog important
elumalai7
 
Developing Interactive systems - lesson 2
Developing Interactive systems - lesson 2Developing Interactive systems - lesson 2
Developing Interactive systems - lesson 2
Sónia
 
automation framework
automation frameworkautomation framework
automation framework
ANSHU GOYAL
 
Manageable Robust Automated Ui Test
Manageable Robust Automated Ui TestManageable Robust Automated Ui Test
Manageable Robust Automated Ui Test
John.Jian.Fang
 
Calabash-android
Calabash-androidCalabash-android
Calabash-android
Adnan8990
 
Advanced Swift Generics
Advanced Swift GenericsAdvanced Swift Generics
Advanced Swift Generics
Max Sokolov
 
Deeper into Windows 10 Development
Deeper into Windows 10 DevelopmentDeeper into Windows 10 Development
Deeper into Windows 10 Development
Shahed Chowdhuri
 
Ad

Automated Xcode 7 UI Testing

  • 1. Automated Xcode 7 UI Testing HelsinkiOS 26 August 2015
  • 2. Xcode 7 Features — Testability. Write tests of Swift 2.0 frameworks and apps with access to all your public and internal routines — User interface testing and recording. Test applications at the user interface surface with elements, queries, and simulated events. The UI recording feature enables capture of UI actions into source to facilitate creating tests (DEMO) — App thinning (iOS 9 SDK), Xcode bots + OS X Server with on demand resources (ou-es ten server)
  • 3. Xcode 7 Features (cont) — Free Provisioning. Develop on your own device, mechanism to provision and install development project on physical devices for testing and evaluation. — Code coverage. Provides report information to evaluate a test suite for completeness.
  • 4. Code Coverage — Visualize the completeness of your test suite by enabling code coverage for your scheme. The code coverage tab in the test report shows which files, functions and lines of code were exercised and, more importantly, which were not exercised. The source code editor can also show code coverage information inline, allowing you to see at a glance which lines— and parts of a line—the tests exercised. (3555436)
  • 6. Beta 4 — Using UI recording generates code for iOS gestures like doubleTap, twoFingerTap, longPress, swipeUp, swipeDown, swipeLeft, and swipeRight. (20278248) — Code coverage works with UI testing. (20966994)
  • 7. Beta 5 — Code Coverage now supports files in static libraries. The source files show up under each binary that links the static library in the Coverage tab of the Test Report. The source editor shows coverage numbers aggregated across all binaries. (21984681)
  • 8. Beta 6 — XCTest offers API to automate complex controls such as date pickers. (20577276) — Apps with names that contain parenthesis can be exported from the Archives organizer. (22142125) — Ability to interact with hardware buttons, like XCUIDeviceButtonHome. — Ability to interact with XCUIElementTypeSlider and XCUIElementTypePickerWheel — Ability to handle alerts that gets in the way with the new add/ removeUIInterruptionMonitor APIs
  • 9. Known Problems (Beta 6) — UI testing cannot identify elements using information from their accessibility title element. Workaround: Set an accessibility identifier instead. (20409319) — UI testing cannot record or interact with popovers on OS X. (21162677) — UI tests do not support key modifiers on iOS. (20185910, 21033224) — When recording a UI Test for an OS X app, Xcode Helper, not Xcode, asks to use the Accessibility APIs. This app uses the Accessibility APIs when running UI Tests. (21211897)
  • 10. Syntax -XCUIApplication — Proxy to application, separate from app (runs in separate process) — Can control when to launch or terminate app app.launchEnvironment = ["myValue": "value"] app.launch() if let value = NSProcessInfo.processInfo().environment["myValue"] { // do something with value }
  • 11. Syntax -XCUIElement — Application is a tree of elements with hierarchy (think DOM tree) — Element must be unique — Based on UIControl (button, table cell, window) — Accessibility identifier, label, title, etc. — Custom element visibility e.g. via Interface Builder Accessibility Inspector
  • 12. Syntax -XCUIElementQuery — Must resolve to single element, otherwise failure — Evaluated on-demand and re-evaluated when used (think URL lifecycle) — "exists" property can be used to safely test elements — Elements visible via accessibility — Relationships and filtering — Chain queries
  • 13. Syntax -XCTest Assertions 1 XCTAssert(expression, format...) XCTAssertTrue(expression, format...) XCTAssertFalse(expression, format...) XCTAssertEqual(expression1, expression2, format...) XCTAssertNotEqual(expression1, expression2, format...) XCTAssertEqualWithAccuracy(expression1, expression2, accuracy, format...) XCTAssertNotEqualWithAccuracy(expression1, expression2, accuracy, format...) XCTAssertNil(expression, format...) XCTAssertNotNil(expression, format...) XCTAssertNil(expression, format...) XCTAssertNotNil(expression, format...) 1 XCTestCase / XCTestExpectation / measureBlock() at NSHipster
  • 14. Debug — Use breakpoints in test cases — Same familiar LLDB debugger and commands 2 — Test reports at Xcode Report Navigator — Automatic screenshots — Just re-record test cases, it's that easy !!! 2 About LLDB and Xcode by Apple
  • 15. Demo...awesome !!! Just look at that dynamic realtime code refactoring, when recording test cases O_O
  • 16. More info — Xcode 7 Beta 6 Release Notes — WWDC 2015 video + PDF 406: UI Testing in Xcode — WWDC 2015 video + PDF 410: Continuous Integration and Code Coverage in Xcode — WWDC 2014 video + PDF 415: Continuous Integration with Xcode 6 — XCTest and UI Testing documentation by Joe Maselotti — XCTestCase / XCTestExpectation / measureBlock() at NSHipster — UIAccessibility documentation by Apple
  • 17. Thank You! Any questions? SlideShare. Jouni Miettunen - [email protected] @jomtwi at Elisa Software Services, looking for mobile developers