A comparison of the current iOS feature testing frameworks available.
Comparison overview of each of the frameworks' features such as UIControl
interaction, remote processes, and the ability to be run from the command line.
Feature | Frank | UIAutomation | Subliminal | KIF |
---|---|---|---|---|
iOS 8+ support | π | π | π | π |
Run from CI | π | π | π | π |
Animation waiting | πΒΉ | π | π |
Feature | Frank | UIAutomation | Subliminal | KIF |
---|---|---|---|---|
Reading UILabels | π | π | π | π |
UITableView interaction | π | π | β | π |
Scrolling UIScrollViews | π | π | π | π |
Standard UIAlertViews | π | π | β | π |
Typing into UITextFields | πΒ² | π | π | π |
Tapping UIControls | π | π | π | π |
Sliding UISliders | π | β | πΒ³ | π |
UIKit visibility | π | π | π | π |
UIActionSheet interaction | π | π | π | π |
UIPickerView interaction | π | πβ΄ | π | π |
Swipe to delete | β | β | β | π |
Feature | Frank | UIAutomation | Subliminal | KIF |
---|---|---|---|---|
UIWebView interaction | β | π | π | π |
WKWebView interaction | β | π | ββ΅ | β |
Feature | Frank | UIAutomation | Subliminal | KIF |
---|---|---|---|---|
Remote controllers | β | π | ββ΅ | β |
System UIAlertViews | β | π | β | π |
Backgrounding/foregrounding | β | β | β | β |
Feature | Frank | UIAutomation | Subliminal | KIF |
---|---|---|---|---|
Objective-C | β | β | π | π |
BDD-style | π | β | β | πβΆ |
Can be debugged | π | β | πβ· | π |
Does not require Instruments.app | π | β | β | π |
Focus tests | π | β | π | πβΈ |
Cocoapods support | π | n/a | π | π |
Inspect view hierarchy from frameworkβs PoV | π | π | π | πβΉ |
π = Full support π = Support with caveats
A more detailed look into the pros and cons of each framework.
- How easy it is to write tests first
- Familiarity with language tests are written in
- Ability to be run via the command line and on CI
- Reliability
- Coverage
- How close to real interaction it is
- Documentation
- Community
- Framework maintenance
- Ability to run on physical devices (nice to have)
- Developer can target UI elements via css-like selectors. This frees the developer from having to know ahead of time the implementation of the view hierarchy.
- Tests are written in Ruby with lots of Cucumber helper steps optionally available.
- There is a single command to "Frankify" the app, but CI setup takes more custom work.
- Some tests can become flaky if written poorly. Asynchronous behavior quickly becomes unreliable, especially with animations and chaining events.
- Most user interactions are able to be reproduced. The exceptions are
MFMailComposeViewController
,ABPeoplePickerNavigationController
, and other controllers that aren't actually handled inside the app (eg. asking for location permissions and access to the address book). There are workarounds for some but not all of these issues. - The framework uses UIAutomation when possible but some interactions are not as "true" as they could be. Lot's of Frank's magic comes from
UIKit
objects being extended. For example, swiping views is all done in Objective-C to workaround it not being available in UIAutomation. - There is a decent amount of setup and implementation details on the website but lots of the functionality isn't documented or explained.
- frank-discuss Google group is more of a knowledge base than an active discussion forum. Stack Overflow is lacking information on Frank.
- Frank is maintained so poorly we have considered forking it and maintaining it on our own. This, however, has improved since iOS 8 has launched.
- Frank claims to be able to run on devices but I haven't gotten it to work.
- UIAutomation requires that each level of the view hierarchy be explicitly referenced. For example, to access a button in a scroll view your syntax would look something like
UIATarget.localTarget().frontMostApp().mainWindow().scrollViews[0].buttons()[0]
. This makes your feature tests tied to the implementation of your view hierarchy. - UIAutomation is written in JavaScript. There are a number of wrappers built on top of it to help make it less verbose, such as bwoken and tuneup_js.
- It is possible to run UIAutomation scripts via the command line with the some custom build scripts. The main idea is to inject the JavaScript into the app and then run it via Instruments.
- While reliable when running via the GUI and command line, there is a race condition bug in Instruments that occurs on lower-end machines. This makes it particularly difficult to use when running as CI on a Mac Mini.
- UIAutomation should be able to cover 99% of all use cases when running on a mobile device. However, a portion of these are broken with the introduction of iOS 7 (and continue to remain broken in iOS 8). These range from basic features such as scrolling views to very complex interactions like putting the app to sleep for five seconds.
- Being UIAutomation is from Apple it should be as close to βrealβ user interaction as possible.
- Most of Appleβs documentation exists in the UI Automation JavaScript Reference pdf.
- There is a fair amount of talk online regarding UIAutomation and even a book from Pragmatic Bookshelf, Test iOS Apps with UI Automation: Bug Hunting Made Easy, covering how best to use.
- Apple owns it and itβs closed source. It doesnβt appear that any updates have occurred since iOS 6.
- Works but takes an extra couple of seconds to get installed on the device.
- Similar to KIF, all views are interacted with via their accessibility labels. Subliminal traverses the view hierarchy looking for each match, no knowledge the way the views are laid out is needed.
- Tests are written in Objective-C as subclasses of XCTest.
- While no issues are apparent in Subliminal itself, the tests are run through Instruments which carries its own slew of problems. See UIAutomationβs notes on Reliability for more information.
- Subliminal has the best coverage off all the frameworks, even better than UIAutomation itself. Most of the broken parts of UIAutomation have been patched (either in Objective-C or JavaScript directly) and work well. One of the few remaining limitations is lack of interaction with WKWebView.
- Beings it runs UIAutomation scrips under the hood, interaction should be as close to βrealβ user interaction as possible.
- Every public method is documented with expectations and parameters with full integration into Dash.
- Despite its shortcomings Subliminal seems to have the largest community of users. Twitter even publicly acknowledged using it.
- There havenβt been many recent commits to master and the Xcode 6 / iOS 8 branch has been open for almost six months.
- Subliminal claims to be able to run on devices but I haven't gotten it to work.
- All views are interacted with via their accessibility labels. Since KIF traverses the view hierarchy looking for each match, no knowledge the way the views are laid out is needed.
- Tests are written in Objective-C as subclasses of XCTest.
- Tests are run with the standard
xcodebuild test
command. - KIF is the most reliable of all the frameworks tested.
- Similar to Frank, most user interactions are able to be reproduced. KIF still suffers from the same issues that plague Frank (e.g. it canβt interact with views outside of the appβs control). However, with recent additions it now can interact with system alerts (e.g. location services and photo authorization dialogs).
- Most (if not all) of KIFβs interaction boils down to create
UITouch
events at the right point and sending them to the app. - Every public method is documented with expectations and parameters with full integration into Dash.
- There is a Google Group which only gets about one post per week. The same goes for the official StackOverflow tag, kif-framework.
- Framework is actively maintained with PRs being addressed within a few days of submission.
- Works for all cases except interacting with system alerts.
- ΒΉ Some animations are handled without interaction, while others require manual waiting.
- Β² Sometimes Frank is so eager to type, he doesnβt wait for the UITextField to fully focus, leading to dropped characters. Workarounds are possible.
- Β³ Subliminal can slide a slider and successfully call delegate methods, but the computation of the physical nub offsets are left to you.
- β΄ UIAutomation makes each UIPicker selection on value at a time, making selection very slow. Also, if the date is not selectable UIAutomation will silently fail.\
- β΅ Subliminal cannot interact with these elements directly, but can call into UIAutomationβs JavaScripts via
SLTerminal -eval:
. - βΆ Kif itself isn't a BDD framework, but integrates seamlessly with BDD frameworks such as Quick.
- β· Subliminal loops over Objective-C code which calls JavaScript asynchronously via Instruments making debugging possible, but quite difficult.
- βΈ Tests can be focused in Xcode via tapping the gutter (ala XCTest) but not via the command line.
- βΉ You can use the Accessibility Inspector to identify elements for KIF to interact with, but there isnβt a direct way to view the hierarchy or identify elements which KIF ignores because they are accessibility containers.
- Xcode 6.1
- iOS 8.1
- Frank 1.2.3
- Subliminal 1.1.0 - shared/Xcode6 branch - d99fef4 commit
- KIF - 3.0.8