krishworkstech.com

Part 14: iOS Automation Basics (XCUITest)

Part 14 : iOS Automation Basics (XCUITest)

  • What is XCUITest?
  • macOS-only requirements:
    • Xcode
    • Carthage
    • WebDriverAgent
  • Setting up simulator or real iPhone
  • Writing first iOS test with Appium
COVER 15 (1)
COVER 16

Share at:

grok-1
chatgpt-6
gemini-icon-logo
perplexity-color-1-

1. What is XCUITest?

XCUITest is Apple’s native UI testing framework for iOS apps.
It is built on top of XCTest and is used to automate:

  • iOS apps
  • iPadOS apps
  • tvOS apps

Key Points

  • Developed and maintained by Apple
  • Written in Swift or Objective-C
  • Direct access to iOS UI elements
  • Faster and more stable than older tools (like UIAutomation)

Role in Appium

Appium uses XCUITest as the automation backend for iOS devices.

Appium → WebDriver protocol → WebDriverAgent → XCUITest → iOS App

image 1
image 1 (1)

2. MacOS-Only Requirements (Why macOS?)

iOS automation cannot be done on Windows or Linux because:

  • Apple restricts iOS development tools to macOS
  • Xcode is mandatory
2 (2)
2 (3)

3. Required Tools Explained

3.1 Xcode

Xcode is Apple’s official IDE.

Used for :

  • iOS SDKs
  • Simulators
  • Compiling WebDriverAgent
  • Signing apps

Required version depends on:

  • iOS version
  • Xcode version compatibility
image 2 (1)
image 2 (1) (1)

3.2 Carthage

Carthage is a dependency manager for macOS.
Why Appium needs it:

  • WebDriverAgent dependencies are managed via Carthage

Install :

				
					brew install carthage
				
			
image 3 (1)
image 3 (1) (1)

3.3 WebDriverAgent (WDA)

WebDriverAgent is the bridge between Appium and XCUITest.
Responsibilities:

  • Launching the app
  • Finding UI elements
  • Performing taps, swipes, typing
  • Sending responses back to Appium

Location :

				
					node_modules/appium-webdriveragent/
				
			

Must be :

  • Compiled
  • Signed
  • Installed on simulator or real device
image 4 (2)
image 4 (2) (1)

3.4 Simulator or Real iPhone Setup

iOS Simulator

  • Comes with Xcode
  • No provisioning profile needed
  • Faster setup
  • Limited hardware feature testing
Real iPhone
  • Requires Apple Developer account
  • Provisioning profile & signing
  • Needed for :
    • Push notifications
    • Camera
    • Face ID / Touch IDt
    • Real-world behavior
image 5 (2) (2)
image 5 (2) (1)

4. Architecture Overview

				
					Test Script (Java / Python / JS)
        ↓
     Appium Server
        ↓
 WebDriverAgent (XCUITest)
        ↓
   iOS App (Simulator / Device)

				
			

5. Writing Your First iOS Test with Appium (Example)

5.1 Start Appium Server

				
					appium
				
			

5.2 Desired Capabilities (Example – Java)

				
					IOSOptions options = new IOSOptions();

options.setPlatformName("iOS");
options.setPlatformVersion("17.0");
options.setDeviceName("iPhone 15");
options.setAutomationName("XCUITest");

// App path (.app for simulator, .ipa for real device)
options.setApp("/path/to/MyApp.app");

// Optional but useful
options.setNoReset(true);
options.setNewCommandTimeout(300);

				
			

5.3 Create Driver

				
					IOSDriver driver = new IOSDriver(
    new URL("http://localhost:4723/wd/hub"),
    caps
);

				
			

5.4 First Test Action

				
					driver.findElement(By.name("Login")).click();
				
			

5.5 Quit Session

				
					driver.quit();
				
			

6. Common XCUITest Locator Strategies

  • accessibility id (preferred)
  • name
  • label
  • class chain
  • predicate string
  • xpath (last option)

Example :

				
					driver.findElement(AppiumBy.accessibilityId("usernameField"));
				
			

7. Advantages of XCUITest with Appium

  • Official Apple framework
  • High stability
  • Supports modern iOS versions
  • Works on simulators and real devices

8. Common Challenges (Beginner Awareness)

  • Code signing errors
  • WebDriverAgent build failures
  • Xcode version mismatch
  • iOS updates breaking compatibility

Summary

  • XCUITest is Apple’s native iOS automation framework
  • Appium uses XCUITest via WebDriverAgent
  • macOS + Xcode are mandatory
  • Ideal for scalable, cross-platform mobile automation

Building complex IoT systems?

Accelerate testing and deployment with our QEMU-integrated toolchain expertise.

Mastering Appium: A Complete Beginner-to-Expert Mobile Automation Guide

image (5) (1)
COVER 3

Part 2 : Appium Architecture, Tools Setup & How Test Code Connects to Devices

COVER - PART 4

Part 3 : Java Fundamentals for Test Automation

Group 1707478330
COVER 3

Part 5 : Setting Up the Environment (Windows & macOS)

Group 1707478196 (1) (1)

Part 6 : Understanding UiAutomator2 (Android Engine)

Group 1707478196 (1)
COVER 3 (1)

Part 8 : Handling Waits and Synchronization in Appium (Android)

COVER 3

Part 9 : Element Locator Strategies in Android (ID, XPath, etc.)

COVER 3 (2) (1)
COVER 3 (2)
COVER 3 (3)

Part 11 : Page Object Model (POM) Design in Appium (Android)

COVER 3
Group 1707478196
Rectangle 26832 (1)

Part 14 : iOS Automation Basics (XCUITest)

Scroll to Top
  • Schematic design
  • PCB and schematic source files
  • Assembling drawing files
  • Providing prototype/sample and production PCB service
  • Testing and validation of designed hardware
  • HIPAA
  • Azure Key
  • Management
  • ES, Checksum,
  • MD5sum
  • AWS
  • Azure
  • GCP
  • DigitalOcean
  • Kotlin
  • Python
  • Tensorflow
  • Computer Vision
  • ECG
  • SPO2
  • Heart Rate
  • Glucometer
  • Blood Pressure
  • UX UI Process
  • Figma and FigJam
  • Adobe Suite
  • Selenium Java
  • Postman
  • Swagger
  • Jmeter
  • SQL
  • Java Scripter
  • Test ng
  • Extents Reports
  • Flutter
  • Java
  • Kotlin
  • Swift
  • Dart
  • React JS
  • Python
  • NodeJS
  • Django
  • HTML, CSS, JS
RDBMS
  • PostgreSQL
  • Oracle
  • MySQL
  • MariaDB
No SQL Based
  • MongoDB
  • GCP
  • FirestoreDB
  • DynamoDB
  • Azure
  • CosmosDB
  • AWS