Appium is an open source test automation framework for use with apps. You can use Appium to automate iOS apps on real, physical iOS devices such as iPhones, iPods and iPads.
Appium implements the WebDriver protocol for native apps. This protocol defines a standard way for querying which elements (such as buttons or text boxes) are displayed on the screen and to interact with these elements.
Appium runs as a HTTP server on a PC. You write scripts which communicate with this HTTP server to write test automation scripts. Appium uses a plug-in architecture and has multiple drivers. Each Appium driver is a specialized piece of code, which provides specific test automation capabilities. For example, there's a driver for automating Safari on iOS and another driver for automating native applications on iOS devices.
Xcode UI Testing
appium-xcuitest-driver is the Appium driver for automating native iOS applications on current versions of iOS. appium-xcuitest-driver uses the Xcode UI Test framework (xcuitest) to automate UI testing on iOS devices.
xcuitest is part of Xcode. Xcode provides a general-purpose testing framework, XCTest, which can be used to write unit tests and integration tests. xcuitest is a component of XCTest which enables UI Testing.
It interacts with the iOS operating system and allows iOS developers to write scripts which run on iOS devices and automate any part of the iOS user interface. xcuitest actually consists of two pieces: there's an Xcode plug in so that Xcode knows how to interact with iOS devices, and a component which runs on the iOS device itself. These two components communicate with each other, typically over the USB cable you use to connect your iOS device to your PC; but they can also communicate using Wi-Fi.
On the device, xcuitest co-operates with the iOS operating system using a specific daemon: the test manager daemon (testmanagerd).
xcuitest is a framework on its own and provide its own programming interface. It does not implement the WebDriver protocol. That's where the WebDriverAgent comes in. Originally a Facebook-sponsored project, WebDriverAgent is now maintained by the Appium community. It leverages xcuitest, but understands the WebDriver-syntax used by Appium and converts Appium queries and commands to their xcuitest equivalent.
WebDriverAgent is an application written in Objective C and runs on iOS devices. You'll need to install WebDriverAgent on your iOS device when you want to run Appium tests on iOS devices. If you use Appium, Appium automatically installs WebDriverAgent for you.
Appium uses Xcode to install and launch WebDriverAgent. It communicates directly with WebDriverAgent over the HTTP protocol. At the same time, Xcode keeps running in the background to keep WebDriverAgent active on the iOS device.
Appium uses the appium-xcuitest-driver to automate the user interface of iOS devices. This driver uses Xcode to launch and install the WebDriverAgent on your iOS devices, which then leverages xcuitest to interact with the iOS operating system. Because of this dependency on Xcode, the appium-xcuitest-driver only runs on macOS.
This is where xcuitrunner comes in. It allows you to launch the WebDriverAgent on iOS devices, and does not have a dependency on Xcode. In fact, you can run xcuitrunner Windows, Linux or macOS.
You can use this to automate iOS devices using Windows or Linux. There are two ways you can leverage xcuitrunner:
- You can communicate directly with the HTTP server which WebDriverAgent exposes. The WebDriverAgent implements the WebDriver protocol, so you can use standard WebDriver client libraries to interact with the WebDriverAgent and automate iOS devices. In most cases, appium-xcuitest-driver directly forwards requests to WebDriverAgent. However, some functions may be implemented by the appium-xcuitest-driver and are not available when you interface directly with the WebDriverAgent.
- You can use vanilla Appium on a Linux machine. xcuitrunner has an Xcode compatibility layer, which allows Appium to interface with it in the same way as it would with Xcode.