Using Xcode 7 with Xamarin.UITest

PDF for offline use

Let us know how you feel about this

Translation Quality


0/250

last updated: 2016-10

Overview

Apple provides two different automation APIs for testing applications, the older UIAutomation and the new XCUITest. However, the XCUITest APIs are not directly used by Xamarin.UITests. Instead Xamarin.UITests interactes with the DeviceAgent, which encapsulates the UITest APIs.

UIAutomation will be used when building apps with Xcode 7, while XCUITest is used by by XCode 8.

The latest versions of Calabash and UITest support testing with both Xcode 7 and Xcode 8. The verison of Xcode used to build the app will determine which native automation API is used to automate the app. The Testing Framework and iOS compatibility for Calabash is determined by the version of Xcode that is used. See the table below:

iOS Version Local with Xcode 7 Local with Xcode 8
iOS 7 UIAutomation n/a
iOS 8 UIAutomation n/a
iOS 9 UIAutomation DeviceAgent
iOS 10 n/a DeviceAgent

For example, a Mac with Xcode 8 installed will be able to test on devices running iOS 10 or iOS 9 using DeviceAgent, but would not be able to test on iOS 8 or below.

If you still need to test on iOS 8 devices or older, we recommend installing Xcode 7 alongside your default installation of Xcode 8, and switching your Xcode version when needed.

Please note that Xamarin Test Cloud will always run iOS 9 and older device tests using the older UIAutomation API; it will not use the DeviceAgent. No additional steps are required to test these devices in Xamarin Test Cloud. Devices that are running iOS 10 will automatically use the DeviceAgent; any tests that try to invoke the older UIAutomation APIs will fail.

Testing on iOS 8 and Lower

To test on older versions of iOS, it is necessary to install Xcode 7 alongside the default installation of Xcode 8.

To find the current version of Xcode, run the following command:

$ xcrun xcodebuild -version
Xcode 8.0
Build version 8S201h

To switch to a different version of XCode, set the DEVELOPER_DIR environment variable to point to the /Contents/Developer/ folder that contains the alternate version of Xcode. For example

$ export DEVELOPER_DIR=/Applications/Xcode7.app/Contents/Developer/

Xamarin Workbook

If it's not already installed, install the Xamarin Workbooks app first. The workbook file should download automatically, but if it doesn't, just click to start the workbook download manually.