Appium XCUITest Driver Setup
We will now be discussing about the process of running Appium XCUITest Driver Setup. Further, we will elaborate more about installing dependencies, process of configuration etc. We will now be discussing installing dependencies.
Appium iOS real device support depends on a central third-party software suite, libimobiledevice, which is easily installable with Homebrew –
brew install libimobiledevice –HEAD
Additionally, Appium support for real devices running iOS 9.3 and above using Xcode 8+, which depends on ios-deploy. It is easily available through npm or Homebrew:
npm install -g ios-deploy
brew install ios-deploy
For hybrid or web tests, you may also need to follow the ios-webkit-debug-proxy setup instructions. The Appium XCUITest driver works via the installation of a helper application called WebDriverAgent-Runner onto the device. Using which the application under test is automated.
Basic (Automatic) Configuration
One of the best way to get up-and-running with Appium’s XCUITest Driver support on iOS real devices is to use the automatic configuration strategy. You may use two ways to do this –
- Use the xcodeOrgId and xcodeSigningId desired capabilities:
“xcodeOrgId”: “<Team ID>”,
“xcodeSigningId”: “iPhone Developer”
- Create a .xcconfig file somewhere on your file system by adding the following
DEVELOPMENT_TEAM = <Team ID>
CODE_SIGN_IDENTITY = iPhone Developer
Once this configuration is done, it should just be a matter of starting your test specifying a real device in your udid desired capability.
Tacking Testing Failure
In case, the test target WebDriverAgentRunner encountered an error (Early unexpected exit, operation never finished bootstrapping – no restart will be attempted). Further, the problem is that the developer is not trusted on the device. Also, if you manually try to run the WebDriverAgentRunner app on the device, you will see the following popup message –
You can go to Settings => General => Device Management on the device to trust the developer and allow the WebDriverAgentRunner app to be run.
Basic (Manual) Configuration
There are many cases in which the basic automatic configuration is not enough. Moreover, this has to do with code signing and the configuration of the project to be able to be run on the real device under test. Often, this happens when the development account being used is a “Free” one, in which case it is not possible to create a wildcard provisioning profile, and will often not create one for the default application bundle. Therefore, this will manifest as something like an error that Xcode failed to create provisioning profile,
- No provisioning profile – The easiest way around this is to create a provisioning profile by opening Xcode and creating a new project.
- Create new project – The type does not matter, other than it being “iOS”. “Single View Application” is the easiest
- Create single page – The important part is to use a unique “Product Name” and “Organization Name”. Also, at this point, specify your “Team”.
- Setup bundle – You can confirm that the provisioning profile was created by looking at the “Project” tab:
Check provisioning profile
Further, at this point you have a valid provisioning profile. Also, make note of the bundle id you associated with it. And add that in the updatedWDABundleId desired capability for your tests. Then follow the initial instructions for automatic configuration.
Configuring the app under test
The WebDriverAgent need to be configured to run on your device, but your app must also be able to run on your device.But, the central requirements are the same i.e., to have a build of your app (an .ipa file) signed with a development provisioning profile. A good overview of the process can be found here and here.
Further, Appium handles installing the application to the device, using ideviceinstaller, but it is sometimes easier to pre-install your app using Xcode to ensure there are no problems.