UI Automation testing on iOS9
During WWDC2015, Apple announced big stuff, but they also released awesome features for developers. One of them was dedicated to UI Testing. Working around UI Automation test, I’ve just discovered last Xcode 7 and how life is going to be easier with their last feature for that.
UI Test framework is the perfect mix between Unit Test framework and Instruments Automation. On your Xcode project, you can add a new target, specifying that a UI Test. Once done, your project is already ready to test.
When your method is ready to be tested, you only need to pick the checkbox for the method like for Unit Test. You can now launch your app on the UI Test target and see how your test is executed.
At the end of your test, you can see time of execution for each line of code and how long the compiler wait for a result. Linked to each row, you can have quick look of the last state of the screen, and that is pretty cool!
Like Instruments, you are able to get access to a given element from it accessibility label. If a same label has many occurrences, like a UITableViewCell, you can list them a sort it to find the good one.
However, I also can see few weaknesses in that: for automation test, UI Testing can be only deployed on OSX Server and obviously it’s only available for iOS9+. I’m not sure if it’s enough efficient to manage advanced tests when we know that all apps are linked one to each other, with deep linking and other SDK, and I didn’t talk about Bluetooth and native stack yet.
But I’m looking forward testing that this summer on physical device. During this time, here is the video of UI Testing in Xcode, so brilliant and understandable that I hope you’ll watch it.