SlideShare a Scribd company logo
IOS App testing with XCTest and XCUITest
Mobile Testing platforms for developers and testes to test their app on
targeted region specific smartphones and networks
Who we are?
What all we are going to cover?
 IOS Automation challenges
 Current tool options
 Introduction to XCTest and XCUITest
 Creating a basic automation script
 Understanding impact of XCUITest on Appium
IOS Automation challenges
 Any Automation tool has for IOS has to rely on Native Test Framework
provided by Apple ( UIAutomator or XCUITest)
 Native framework have limited set of APIs restricting the type of actions
that can be performed on Apps during Automation
 IOS App resigning and distribution profile is quite cumbersome.
What are the current options for IOS automation?
Features/Tools
Appium (>1.6
version)
Calabash XCTest XCTUITest EarlGrey
Type of Mobile
Application Supported
Native Yes Yes Yes Yes Yes
Hybrid Yes Yes Yes Yes Yes
Mobile Web Yes No No No No
Type of Automation
Scripts
UI Driven Functional
Tests
Yes Yes No Yes Yes
Unit Tests No No Yes No Yes
Scripting Language
Java, C#, Ruby,
Python, Perl
Cucumber, Ruby
Objective C,
Swift
Objective C,
Swift
Objective
C
Test Recording
capability
Partial ( Using
Appium Inspector)
No Yes Yes No
Features/Tools
Appium(Including
XCUITest)
Calabash XCTest XCTUITest EarlGrey
Multi Device Execution (on in-
house devices)
Yes ( Selenium Grid)
Framework Dev
required
Framework Dev
required
Framework Dev
required
Framework Dev
required
Multi Device Execution (on
Cloud Platforms like pCloudy)
Yes Yes Upcoming Upcoming Upcoming
Integration with CI tools
(Jenkins)
Plug-ins available Plug-ins available
Framework
Development
required
Framework
Development
required
Framework
Development
required
Ease of learning
medium medium
Complex ( For
developers)
Complex ( For
developers)
Complex ( For
developers)
Object Recognition Method
Native Object Recognition
( Based on Object
Properties)
Native Object
Recognition ( Based on
Object Properties)
Native Object
Recognition (
Based on Object
Properties)
Native Object
Recognition (
Based on
Object
Properties)
Native Object
Recognition (
Based on Object
Properties)
Support
Extremely Active
Community
Average
Supported by
Apple
Supported by
Apple
Supported by
Google
What are the current options?
Introduction to XCTest
 XCTest is testing framework provided by XCode. Released with XCode 5
 XCTest provides the ability to create
 Test case subclasses
 Test Methods
 Assertions
 Allows tests to be run directly from the source code
 Supports both Objective C and Swift
 It can be used as part of CI using XCode server and XCodeBuild.
 A significant improvement to the framework with launch of XCUITest wit
XCode 7
Introduction to XCUITest
 XCUITest is combination of XCTest and Accessibility Framework by XCode.
 Accessibility framework provides all the API to perform UI actions like Tap,
Swipe etc.
 XCUITest allows UI Testing
 Find elements on UI Interface
 Perform UI Actions on those elements
 Validate UI properties
 In terms of IOS versions , XCUITest can work for IOS 9 and above
Let’s understand the ecosystem
XCTest XCode XCodeServer XCodeBuild
Command Line
Tool to build and
execute tests.
This is used by
XcodeServer
Used for
Continuous
Integration.
Schedule bot
Runs and
generate reports
IDE where tests
be written or
recorded
Test Framework
Concept of Hosting
Understanding the difference
XCTest .app file
XCUITest UI Test Runner
.app file
Host Application
Host Application
Target Application
Test Bundle
Test Bundle
Scripting Elements
There are three core APIs
 XCUIApplications
let app = XCUIApplication()
 XCUIElements and XCUIElementQuery
let emailTextField = app.textFields["Email"]
emailTextField.typeText("testmunkdemo@testmunk.com")
 Assertion
XCTAssertEqual(app.textFields.count, 2);
Let’s create a basic test
Impact on Appium
On IOS, Appium proxies commands to UIAutomation script ( part of Instruments). UI
Automation scripts are Java scripts to interact with APP UI.
Impact on Appium
For IOS 9.x and above
UIAutomation
with
Instruments
Deprecated
and replaced
with
All the scripts written with UIA will fail with XCode 8 and can’t be run for IOS 9.3
above versions
Impact on Appium
The following capabilities need to be set after creating AppiumDriver object to run
XCUITest above v9.3
Please refer to the following blog for more information of Appium execution on pCloudy
https://www.pcloudy.com/xcuitest-for-ios-apps-and-how-to-test-with-xcode/
if (device.getVersion().compareTo(new Version("9.3")) >= 0) {
// XCUITest
keywords.typeText(By.xpath("//XCUIElementTypeApplication[1]/XCUIElement
TypeWindow[1]/XCUIElementTypeOther[1]/XCUIElementTypeTextField[1]"), "test@t
estname.com", "Email");
keywords.typeText(By.xpath("//XCUIElementTypeApplication[1]/XCUIElement
TypeWindow[1]/XCUIElementTypeOther[1]/XCUIElementTypeSecureTextField[1]"), "
testmunk", "Password");
} else {
// UIAutomation
keywords.typeText(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIATextFiel
d[1]"), "test@testname.com", "Email");
keywords.typeText(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIASecureT
extField[1]"), "testmunk", "Password");
}
XCUITest vs UIAutomation
Summary
 Launch of XCUITest has made significant impact on IOS automation
approach (new and existing)
 XCUITest is future for IOS automation.
 Appium is still the most popular choice of Automation tool for IOS Apps.
It can be used with both UIAutomation for older version and XCUITest
with 9.3 above versions.
Thank You
Let’s change the way Mobile App
Testing is performed

More Related Content

PPTX
iOS Automation: XCUITest + Gherkin
PPTX
Getting Started with XCTest and XCUITest for iOS App Testing
PDF
iOS UI Testing in Xcode
PDF
Testing iOS10 Apps with Appium and its new XCUITest backend
PDF
UI Testing with Earl Grey
PDF
iOS UIAutomation
PDF
Automated Xcode 7 UI Testing
iOS Automation: XCUITest + Gherkin
Getting Started with XCTest and XCUITest for iOS App Testing
iOS UI Testing in Xcode
Testing iOS10 Apps with Appium and its new XCUITest backend
UI Testing with Earl Grey
iOS UIAutomation
Automated Xcode 7 UI Testing

What's hot (20)

PDF
Make XCUITest Great Again
PDF
Xcode 7 UI Testing - Xcake Dublin, October 2015
PDF
[XCode] Automating UI Testing
PPTX
Mobile Worshop Lab guide
PDF
Automated Testing with GHUnit and KIF
PDF
Android Building, Testing and reversing
PPTX
Ios ui automation test framework
PDF
Xcode7 UI Automation
PDF
少し幸せになる技術
PPTX
SwtBot: Unit Testing Made Easy
KEY
SWTBot Tutorial
PPT
JsUnit
PDF
Ten Minutes To Tellurium
PPT
Writing and Testing JavaScript-heavy Web 2.0 apps with JSUnit
PDF
Functional Testing made easy with SWTBot for Developers and Testers
PPT
Swtbot
PDF
Data Flow Patterns in Angular 2 - Sebastian Müller
PDF
UI testing in Xcode 7
PPT
Tellurium 0.7.0 presentation
DOCX
Activity
Make XCUITest Great Again
Xcode 7 UI Testing - Xcake Dublin, October 2015
[XCode] Automating UI Testing
Mobile Worshop Lab guide
Automated Testing with GHUnit and KIF
Android Building, Testing and reversing
Ios ui automation test framework
Xcode7 UI Automation
少し幸せになる技術
SwtBot: Unit Testing Made Easy
SWTBot Tutorial
JsUnit
Ten Minutes To Tellurium
Writing and Testing JavaScript-heavy Web 2.0 apps with JSUnit
Functional Testing made easy with SWTBot for Developers and Testers
Swtbot
Data Flow Patterns in Angular 2 - Sebastian Müller
UI testing in Xcode 7
Tellurium 0.7.0 presentation
Activity
Ad

Similar to XCUITest for iOS App Testing and how to test with Xcode (20)

PDF
Understanding XCUITest Framework Your Guide to Efficient iOS Testing.pdf
PDF
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
PDF
Top iOS Testing Tools and Frameworks.pdf
PDF
A Comprehensive Guide to Cross-Platform Mobile Test Automation Using Appium.pdf
PPTX
open-west
PDF
A Comprehensive Guide to Efficiently Writing and Implementing iOS Unit Tests.pdf
PDF
Appium Automation Testing Tutorial PDF: Learn Mobile Testing in 7 Days
PDF
A Comprehensive Guide to Choosing Between Appium and XCTest (UI) for iOS App ...
PPTX
Appium.pptx
PDF
Shifting landscape of mobile automation, and the future of Appium - Jonathan ...
PDF
2012 mobile testingsummit-moet
PDF
Appium understanding document
PDF
Test Automation Frameworks for Mobile App Testing.pdf
PPTX
Automation Testing With Appium
PDF
A Step-by-Step Guide to Test Automation with Appium.pdf
PDF
[Srijan Wednesday Webinar] Mastering Mobile Test Automation with Appium
PPT
Test automationslides
DOCX
Rajiv Profile
PDF
Best Mobile Test Automation Solutions: Beyond Appium
PPTX
Appium overview
Understanding XCUITest Framework Your Guide to Efficient iOS Testing.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Top iOS Testing Tools and Frameworks.pdf
A Comprehensive Guide to Cross-Platform Mobile Test Automation Using Appium.pdf
open-west
A Comprehensive Guide to Efficiently Writing and Implementing iOS Unit Tests.pdf
Appium Automation Testing Tutorial PDF: Learn Mobile Testing in 7 Days
A Comprehensive Guide to Choosing Between Appium and XCTest (UI) for iOS App ...
Appium.pptx
Shifting landscape of mobile automation, and the future of Appium - Jonathan ...
2012 mobile testingsummit-moet
Appium understanding document
Test Automation Frameworks for Mobile App Testing.pdf
Automation Testing With Appium
A Step-by-Step Guide to Test Automation with Appium.pdf
[Srijan Wednesday Webinar] Mastering Mobile Test Automation with Appium
Test automationslides
Rajiv Profile
Best Mobile Test Automation Solutions: Beyond Appium
Appium overview
Ad

More from pCloudy (20)

PDF
How to generate Synthetic Data for an effective App Testing strategy.pdf
PDF
How to Test Computer Vision Apps like Google Lens and Google Photos.pdf
PDF
Handling iFrames in Selenium Based Test Automation.pdf
PDF
What Are Virtual Devices And How To Use Them For Testing.pdf
PDF
A Complete Guide to Rapid Automation Testing.pdf
PDF
Headless Browser – A Stepping Stone Towards Developing Smarter Web Applicatio...
PDF
Choosing the Right Testing Strategy to Scale up Mobile App Testing.pdf
PDF
Redefining Mobile App Testing pCloudy’s Comprehensive Framework Arsenal.pdf
PDF
How to Optimize Apps for Digital Accessibility.pdf
PDF
Understanding public Cloud Cloud Real Devices vs. physical devices, VMs and ...
PDF
Public Cloud vs. Private Cloud Making the Right Choice for Mobile App Testing...
PDF
How does Cross Browser testing improve the User Experience.pdf
PDF
Leveraging Self-Healing Techniques to Foster Sustainable Automation Scripts.pdf
PDF
Seamless Integration of Self-Healing Automation into CICD Pipelines.pdf
PDF
Summary of Device Coverage Report 2021.pdf
PDF
SSTS Inc. Selected For The HPE Digital Catalyst Program.pdf
PDF
Test Orchestration and Its Need for Successful Automation (2).pdf
PDF
How to use Generative AI to make app testing easy.pdf
PDF
Why Enterprises Should Opt for Cloud-Based Real Device App Testing.pdf
PDF
Tips To Enhance Your Cross Browser Testing With Minimal Effort.pdf
How to generate Synthetic Data for an effective App Testing strategy.pdf
How to Test Computer Vision Apps like Google Lens and Google Photos.pdf
Handling iFrames in Selenium Based Test Automation.pdf
What Are Virtual Devices And How To Use Them For Testing.pdf
A Complete Guide to Rapid Automation Testing.pdf
Headless Browser – A Stepping Stone Towards Developing Smarter Web Applicatio...
Choosing the Right Testing Strategy to Scale up Mobile App Testing.pdf
Redefining Mobile App Testing pCloudy’s Comprehensive Framework Arsenal.pdf
How to Optimize Apps for Digital Accessibility.pdf
Understanding public Cloud Cloud Real Devices vs. physical devices, VMs and ...
Public Cloud vs. Private Cloud Making the Right Choice for Mobile App Testing...
How does Cross Browser testing improve the User Experience.pdf
Leveraging Self-Healing Techniques to Foster Sustainable Automation Scripts.pdf
Seamless Integration of Self-Healing Automation into CICD Pipelines.pdf
Summary of Device Coverage Report 2021.pdf
SSTS Inc. Selected For The HPE Digital Catalyst Program.pdf
Test Orchestration and Its Need for Successful Automation (2).pdf
How to use Generative AI to make app testing easy.pdf
Why Enterprises Should Opt for Cloud-Based Real Device App Testing.pdf
Tips To Enhance Your Cross Browser Testing With Minimal Effort.pdf

Recently uploaded (20)

PDF
Approach and Philosophy of On baking technology
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Cloud computing and distributed systems.
PDF
KodekX | Application Modernization Development
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Empathic Computing: Creating Shared Understanding
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Encapsulation theory and applications.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Network Security Unit 5.pdf for BCA BBA.
PPT
Teaching material agriculture food technology
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
Approach and Philosophy of On baking technology
Mobile App Security Testing_ A Comprehensive Guide.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Cloud computing and distributed systems.
KodekX | Application Modernization Development
Advanced methodologies resolving dimensionality complications for autism neur...
Empathic Computing: Creating Shared Understanding
Reach Out and Touch Someone: Haptics and Empathic Computing
20250228 LYD VKU AI Blended-Learning.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
MIND Revenue Release Quarter 2 2025 Press Release
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Chapter 3 Spatial Domain Image Processing.pdf
Encapsulation theory and applications.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Network Security Unit 5.pdf for BCA BBA.
Teaching material agriculture food technology
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Understanding_Digital_Forensics_Presentation.pptx

XCUITest for iOS App Testing and how to test with Xcode

  • 1. IOS App testing with XCTest and XCUITest
  • 2. Mobile Testing platforms for developers and testes to test their app on targeted region specific smartphones and networks Who we are?
  • 3. What all we are going to cover?  IOS Automation challenges  Current tool options  Introduction to XCTest and XCUITest  Creating a basic automation script  Understanding impact of XCUITest on Appium
  • 4. IOS Automation challenges  Any Automation tool has for IOS has to rely on Native Test Framework provided by Apple ( UIAutomator or XCUITest)  Native framework have limited set of APIs restricting the type of actions that can be performed on Apps during Automation  IOS App resigning and distribution profile is quite cumbersome.
  • 5. What are the current options for IOS automation? Features/Tools Appium (>1.6 version) Calabash XCTest XCTUITest EarlGrey Type of Mobile Application Supported Native Yes Yes Yes Yes Yes Hybrid Yes Yes Yes Yes Yes Mobile Web Yes No No No No Type of Automation Scripts UI Driven Functional Tests Yes Yes No Yes Yes Unit Tests No No Yes No Yes Scripting Language Java, C#, Ruby, Python, Perl Cucumber, Ruby Objective C, Swift Objective C, Swift Objective C Test Recording capability Partial ( Using Appium Inspector) No Yes Yes No
  • 6. Features/Tools Appium(Including XCUITest) Calabash XCTest XCTUITest EarlGrey Multi Device Execution (on in- house devices) Yes ( Selenium Grid) Framework Dev required Framework Dev required Framework Dev required Framework Dev required Multi Device Execution (on Cloud Platforms like pCloudy) Yes Yes Upcoming Upcoming Upcoming Integration with CI tools (Jenkins) Plug-ins available Plug-ins available Framework Development required Framework Development required Framework Development required Ease of learning medium medium Complex ( For developers) Complex ( For developers) Complex ( For developers) Object Recognition Method Native Object Recognition ( Based on Object Properties) Native Object Recognition ( Based on Object Properties) Native Object Recognition ( Based on Object Properties) Native Object Recognition ( Based on Object Properties) Native Object Recognition ( Based on Object Properties) Support Extremely Active Community Average Supported by Apple Supported by Apple Supported by Google What are the current options?
  • 7. Introduction to XCTest  XCTest is testing framework provided by XCode. Released with XCode 5  XCTest provides the ability to create  Test case subclasses  Test Methods  Assertions  Allows tests to be run directly from the source code  Supports both Objective C and Swift  It can be used as part of CI using XCode server and XCodeBuild.  A significant improvement to the framework with launch of XCUITest wit XCode 7
  • 8. Introduction to XCUITest  XCUITest is combination of XCTest and Accessibility Framework by XCode.  Accessibility framework provides all the API to perform UI actions like Tap, Swipe etc.  XCUITest allows UI Testing  Find elements on UI Interface  Perform UI Actions on those elements  Validate UI properties  In terms of IOS versions , XCUITest can work for IOS 9 and above
  • 9. Let’s understand the ecosystem XCTest XCode XCodeServer XCodeBuild Command Line Tool to build and execute tests. This is used by XcodeServer Used for Continuous Integration. Schedule bot Runs and generate reports IDE where tests be written or recorded Test Framework
  • 10. Concept of Hosting Understanding the difference XCTest .app file XCUITest UI Test Runner .app file Host Application Host Application Target Application Test Bundle Test Bundle
  • 11. Scripting Elements There are three core APIs  XCUIApplications let app = XCUIApplication()  XCUIElements and XCUIElementQuery let emailTextField = app.textFields["Email"] emailTextField.typeText("testmunkdemo@testmunk.com")  Assertion XCTAssertEqual(app.textFields.count, 2);
  • 12. Let’s create a basic test
  • 13. Impact on Appium On IOS, Appium proxies commands to UIAutomation script ( part of Instruments). UI Automation scripts are Java scripts to interact with APP UI.
  • 14. Impact on Appium For IOS 9.x and above UIAutomation with Instruments Deprecated and replaced with All the scripts written with UIA will fail with XCode 8 and can’t be run for IOS 9.3 above versions
  • 15. Impact on Appium The following capabilities need to be set after creating AppiumDriver object to run XCUITest above v9.3 Please refer to the following blog for more information of Appium execution on pCloudy https://www.pcloudy.com/xcuitest-for-ios-apps-and-how-to-test-with-xcode/
  • 16. if (device.getVersion().compareTo(new Version("9.3")) >= 0) { // XCUITest keywords.typeText(By.xpath("//XCUIElementTypeApplication[1]/XCUIElement TypeWindow[1]/XCUIElementTypeOther[1]/XCUIElementTypeTextField[1]"), "test@t estname.com", "Email"); keywords.typeText(By.xpath("//XCUIElementTypeApplication[1]/XCUIElement TypeWindow[1]/XCUIElementTypeOther[1]/XCUIElementTypeSecureTextField[1]"), " testmunk", "Password"); } else { // UIAutomation keywords.typeText(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIATextFiel d[1]"), "test@testname.com", "Email"); keywords.typeText(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIASecureT extField[1]"), "testmunk", "Password"); } XCUITest vs UIAutomation
  • 17. Summary  Launch of XCUITest has made significant impact on IOS automation approach (new and existing)  XCUITest is future for IOS automation.  Appium is still the most popular choice of Automation tool for IOS Apps. It can be used with both UIAutomation for older version and XCUITest with 9.3 above versions.
  • 18. Thank You Let’s change the way Mobile App Testing is performed