This document discusses IOS app testing using XCTest and XCUITest. It covers the challenges of IOS automation, current tool options like Appium, XCTest, and XCUITest. It provides an introduction to XCTest and XCUITest, including how to create a basic automation script. It also discusses the impact of XCUITest on Appium, as Appium now proxies commands to XCUITest for IOS 9 and above, rather than the deprecated UIAutomation framework.
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);
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/
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.