Appium is an open source, cross-platform test automation tool for native, hybrid and mobile web apps, tested on simulators (iOS, FirefoxOS), emulators (Android), and real devices (iOS, Android, Windows, FirefoxOS).
- You don’t have to recompile your app or modify it in any way, due to use of standard automation APIs on all platforms.
- You can use any testing framework.
- Mac OS X 10.10 or higher
- Xcode 7.1 or higher is recommended, with command line tool and iOS SDK installed (iOS SDK usually included in Xcode)
- Apple Developer certificate (for signings)
- Brew, Node.js, Java
- For demo iOS testing, we can download a demo app from Github
Note that for iOS 9.3 and higher, UI Automation will not support any more. Instead, Apple provides testers XCUITest. With XCUITest, Apple has given different class names to the UI elements which make up the view hierarchy. As Appium relies on system frameworks provided by Apple, for iOS 9.3 and greater, we need Appium 1.6 or higher which has built in support for XCUITest. (Source: https://github.com/appium/appium/blob/master/docs/en/advanced-concepts/migrating-to-xcuitest.md#scrolling-and-clicking)
Xcode is an integrated development environment developed by Apple, and used for iOS developers to develop software for MacOS, iOS, watchOS, and tvOS. It is available vis Mac App Store, and free to download after version 4.0. For iOS testing, we need Xcode to build demo application or applications that we want to test, and also complete the configuration of WebDriverAgent.
Environment Configuration (for Appium XCUITest driver)
Homebrew helps testers and developers install the stuff and packages they need that Apple didn’t. After installing Homebrew, we can just use terminal (command line tool) and codes to install packages needed.
To install it, paste the following code at a terminal prompt:
/usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
(the code can be copied from the official website of Homebrew: brew.sh)
Install libimobiledevice and ideviceinstaller
Paste the following code at a terminal prompt:
brew install libimobiledevice --HEAD brew install ideviceinstaller
brew install carthage
Carthage is a framework dependency manager, and used to manage our projects’ dependencies.
Download and install Node.js
Or,use brew and paste the following code at a terminal prompt:
brew install node
npm install -g ios-deploy
Install Ruby and xcpretty
gem install xcpretty
Xcpretty is a fast and flexible formatter for Xcode build. It is a utility that will transform Xcode’s output into a format that is easy to understand and browse quickly.
Install Appium 1.6.5 or above if available
npm install –g appium
Install Appium-XCUITest-driver dependency
mkdir -p Resources/WebDriverAgent.bundlesh
Open the folder of WebDriverAgent.xcodeproj, then modify:
For both of them, change the bundle idenfier, development target, and add your developer certificate.
Then build it to a Generic iOS device, or your real device.
Test it using your real deice:
Run this at the terminal:
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'your udid' test
Run Appium with related capabilities.
So now, open the Appium desktop, enter the capabiltieis, and start the session.
Obtain developer certificate through Apple website. A personal certificate will be fine if the version of Xcode is greater than 7.
Using Xcode to configure:
WebDriverAgent and XCtestWD (Inspector): both of them need to change the signing info:
- WebDriverAgent and WebDriverAgent Runner: change the bundle ID to a unique one, and then add signing information. Both of the WDA and Runner need to do this. Then build it.
- For XCtestWD, the same thing needs to do as well: change the bundle ID, and then add signing information.
Change the permission of folders:
Using chmod -R 777 FilePath