Xcode UI Test Runner in VMs

Using Xcode UI Test Runner in a virtualized environment

Xcode UI Test runner relies on usbmuxd (on Linux) or the Apple Mobile Device Service to connect to your iOS device. These services communicate with your iOS device over USB.

Modern virtualization software allows you to pass through USB devices from your host to VMs.

Unfortunately, this does not always work reliably. For example, when an iOS device connects to usbmuxd or the Apple Mobile Device Service, a handshake occurs, during which the device briefly disconnects and then reconnects.

In some virtualization products, this means the device first reconnects to your host, before being detected by the virutalization software and passed through to the host. This can cause instability and cause your device to not pair properly with your VM.

For this reason, we do not recommend you use iOS devices with VMs.

In the past, we’ve been able to use iOS devices with VMs running on KVM on Linux and VirtualBox on Windows.

The following steps should also help you connecting iOS devices to VMs:

  • Make sure no software running on the host attempts to connect to your iOS device. On Windows, this includes uninstalling iTunes and making sure the Apple Mobile Device Service is either not installed or disabled. On Linux, this includes uninstalling or disabling usbmuxd.
  • If possible, pass through a dedicated USB controller to your VM instead of an individual device. This way, your USB device will never be detected by the host OS.

For more information about the Quamotion xcuitrunner command-line utility, contact us at info@quamotion.mobi.