Using Real Devices with Anka

Executing XCTests on Real Devices with Anka

Anka provides ability to manage and execute tests (e.g. through XCTest) on multiple physical mobile devices connected to the host, through Anka VMs. Use anka usb command to manage real devices connected through the USB interface.

Using Anka USB

Use anka usb to claim a single connected device and then attach it to a VM to run tests against it.

anka usb [OPTIONS] COMMAND [ARGS]...

  Do actions on USB devices

Options:
  --help  Show this message and exit.  [optional]

Commands:
  claim    make a device available for attaching to vms,...
  list     list all available usb devices on this host
  release  release a device back to host availability,...
  
anka usb claim [OPTIONS] LOCATION_NAME_OR_ID

  make a device available for attaching to vms

Options:
  -n, --claim-name TEXT  claim name could be used as additional name
  --help                 Show this message and exit.


anka modify vm add usb-device --help
Usage: anka modify add usb-device [OPTIONS] DEVICE

Options:
  -f, --force  skip device validation
  --help       Show this message and exit.
  
anka  start VMNAME

or (use dynamic configuration):

anka start -d DEVICE_IDENTIFIER VMNAME

With -n, --claim-name flag in anka usb claim command you can claim multiple devices. This will essentially create a group of those devices under that claim name. For example, you may have few iPhone X, few iPhone 7 connected through a USB port to a host. You can claim all iPhone X under the same claim name and all iPhone 7 under a different claim name. Then, you can dynamically assign devices from a specific claimed name to the Vm with anka start -d command. USB devices attached to the VM are released with the following commands.

anka usb release, anka stop, anka suspend