Integration Test Frameworksby Stuart Macgregor (@macgregor_stu)
Unlike my previous testing frameworks comparison, this article will be much more concise, with examples being provided in a github repository instead of inline here. This should keep everyone from falling asleep mid-article.
KIF (Keep It Functional) is the current integration testing framework we use. It has an active community, and a well thought out framework created by the clever developers at Square.
KIF integrates incredibly easily into an application. With Cocoapods, it's literally as simple as setting up a new target, installing via Cocoapods, and writing your tests. However, it's incredibly important that KIF tests stay in their own target, due to the fact that it uses undocumented API's. If these got into production code, they would never pass Apple's App Store review.
KIF is also written in Objective-C, which makes it incredibly easy for developers to write tests (something we focus on here). Unlike UIAutomation and Frank, which are more suited towards typical QA analysts.
KIF is not without its downsides though. Due to the nature of automated testing, there have been some noted bugs in timing and finding the right element at the right time (in some cases, I've had to intentionally wait a second or two before looking for an element because it hadn't been fully loaded by the simulator yet). Also, KIF requires each interactive element to have an accessibility label. Sometimes these labels are implicitly created by Xcode, sometimes not. It's important for both the developer and the tester to keep in communication, and keep these elements labeled and up to date, or the tests will break.
Finally, when running KIF through Jenkins, the developer must provide their own script in order to catch the results from the console. For a full reference on how to get Jenkins and KIF to work well together, see here.
UIAutomation is run through Instruments.app. Launching it is relatively simple: just click the UIAutomation button, and start writing the script. Out of the three, this setup is by far the easiest.
Frank is the iOS implementation of Cucumber. Written in ruby, Frank stays almost entirely outside of the application project completely.
Frank is installed through the gem package manager. After that, you simply run
frank build and
frank launch to launch to the app in the simulator.
Tests are written in ruby. If a tester enjoyed ruby, I would recommend this framework. I don't fall in this category.
While Frank is significantly better than UIAutomation, and runs with Jenkins reasonably well (probably the best out of the three), its heavy dependence on ruby is enough to throw off some objective-C developers. Furthermore, it appears that many of the things Frank does can be done with Kiwi (which makes sense, given that they're both designed for BDD). To be frank (no pun intended), if a developer is using Kiwi, I see no reason to use Frank.
In conclusion, KIF appears to be the best tool for the job as it stands right now. UIAutomation may have a place if it were to allow the exiting and re-entrance of an application, it would be more useful. Frank has no place in our testing suite if we're already using Kiwi. If other developers are not using Kiwi, it would make sense to look into Frank a bit more heavily.
This post is the third in a 3-part series on how Magnetic Bear Studios manages its quality assurance process.