+1 404-214-5804
Enterprise Mobility Blog, Mobile App Testing

Create A Simple But Powerful iOS9 Xcode UI Test

Developers and test engineers can now use Apple’s Xcode with Mobile Labs’ deviceBridge™ and deviceConnect™ to create automated user interface (UI) tests. Apple has included a record-and-play capability to get the ball rolling.

In this post, we’ll explore using Xcode and a deviceConnect cloud-based device to create and run Apple UI automation as part of iOS programming. Apple has made its new test automation capability available only for devices running iOS9 and for Xcode versions 7 or later. Mobile Labs’ deviceBridge (an optionally available feature of deviceConnect) makes the connection between cloud-based devices and Xcode tests.

To get started, let’s look at the devices list in deviceConnect after deviceBridge has retained a device on our demonstration laptop. The device shows “in-use,” reflecting the deviceBridge retention. As a result, this cloud-based, real device is available to tools running on our laptop like Xcode, Tunes, Appium, or Calabash that ordinarily require plugged-in, real devices. Since we’re using deviceBridge as a “virtual USB cable” connecting to a real device in the deviceConnect cloud, no devices are connected to the laptop by real USB cable.


Remotely Viewing the Real Device

While recording, writing, and testing Xcode automation scripts on a cloud device, it’s very helpful both to see and control the remote device. Fortunately, deviceConnect servers will allow a viewer connection to a device retained by deviceBridge. The device’s details page contains a “connect” button for this purpose (user identities must, of course, match).


Pressing the “connect” button starts a viewer session (shown at right) on the device:


Creating an Xcode UI Test

With the device retained by deviceBridge and the viewer open for controlling and viewing the real device, we’re ready to go with Xcode. When we start Xcode and use the “Devices” tool, the list includes the above device on its “virtual USB cable”:


We created a video that demonstrates recording and playing back an Xcode UI test. The real device is shown on screen in the Mobile Labs’ web-based viewer. A test is recorded on the real device using the laptop’s mouse and keyboard to remotely operate the device. After the test is recorded, we play it back.

Apple’s UI automation capability is a good start but can only be used with iOS9 or later. A powerful query capability locates objects and obtains attributes, but as our video shows, scripts tend to be fairly dense and contain long identifiers. On the plus side, support fort refactoring scripts and syncing with the device state appear to be very good.

Did you know Mobile Labs specializes in automating mobile app testing? Click the link to learn more!

For more information about Apple’s UI test capability in iOS9, start here.

Don’t forget to check out our eBook on Amazon, Enterprise Mobile App Development & Testing: Challenges to Watch Out For in 2017 !

To read our latest posts, click here!

Leave a Reply

You must be logged in to post a comment.

Why Mobile Labs?

Mobile Labs provides enterprise-grade, next generation mobile application testing tools. With a focus on security, agility and affordability, Mobile Labs delivers solutions to help you deliver quality mobile apps for Android, iOS and Windows platforms while also helping manage mobile devices in a private, secure cloud.

Contact Mobile Labs

3423 Piedmont Road NE
Suite 465
Atlanta, GA 30305
+1 404-214-5804
twitter  facebook linkedin google-plus SlideShare