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.
Note For real devices running iOS 12, follow the steps outlined in this blog to claim the device https://veertu.com/ios-12-usb-pairing-with-anka-vm-for-ios-ci/.
Using real devices with Anka Build
You have multiple Anka Build nodes(host machines) with real devices attached.
Step 1 - Create node groups in Anka Build Controller corresponding to different device types. For example, all nodes which have iPhone X attached, put them in iPhoneX group. This is only required if you have multiple nodes with same device type attached.
Step 2 - On all the nodes in this group, claim the iPhone X with the same claimname.
anka usb list
anka usb claim -n <claimname> LOCATION_NAME_OR_ID
- Step 3 - Attach it to the VM with
anka modifycommand. Use the claimname from Step 2.
anka modify vmname add usb-device claimname
- Step 4 - Suspend the VM.
anka suspend VMname
Step 5 - Push the VM to the registry with
anka registry pushcommand.
Step 6 - Start a job in your CI which provisions VM in the group(previously definied in Step 1).
Step 7 - The VM provisioned will have access to iPhone X device.
Step 8 - When the VM is deleted, the device will be available for the next provisioned VM.
Using real devices with Anka Flow
anka usb to claim a single connected device and then attach it to a VM to run tests against it. You can attach it in a static manner using
anka modify command or at run time using
anka start -d command.
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
Releasing real devices
Use any of these commands to release device from the VM.
anka usb release,