Latest 0.1.2
License MIT
Platforms ios 9.0
Frameworks XCTest

An iOS Library for UI Testing


  • UI Testing from a vanilla XCTest target
    • Enable / Disable UI Animations
    • Take screenshots on test assertion failures
    • waitForCondition function to free up the UI thread and wait for your block condition to become true (or timeout and move on)
    • pauseForUIDebug() function to allow you to pause a (configurable) amount of time between steps in your tests
      • function becomes a no-op when shouldPauseUI is false (the default)
    • variables to get you the top view controller
  • Example App to demonstrate capabilities

Build Status
CocoaPods CocoaPods

Why not use XCUITests?

  • UITestKit lets you interact with the application code directly from test code
    • Easier mocking of model objects
    • Easier invocation of ViewControllers
    • Lower level access to your application
  • UITestKit provides convenience variables for taking screenshots from failures
  • UITestKit can be far less rigid than XCUITests


To run the example project, clone the repo, and run pod install from the Example directory first.
Example Tests


  • iOS 9.0 or higher


UITestKit is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'UITestKit'

Code Examples


Best Practices

  • It is recommended to create a BaseUITest class that specializes UITestKitBase and provides convenience variables for your application’s view controllers:
/// Gets you the `SquareTabVC` if it's the topVC
var squareTabVC: SquareTabVC? {
    return topVC as? SquareTabVC

/// Gets the `ShapesTableViewController`
var shapeTableVC: ShapesTableViewController? {
    return topVC as? ShapesTableViewController
  • It is recommend that you use the screenshot capability when checking for specific UI’s to be visible or in a specific UI state:
XCTAssertTrue(waitForCondition({ self.shapeTableVC != nil }, timeout: 1), topVCScreenshot)

topVCScreenshot will produce failures like this:

Sample Test Failure with Screenshot

The Screenshot that is produce will look something like the following:


Eric Internicola | Eric’s Github Site


UITestKit is available under the MIT license. See the LICENSE file for more info.

Latest podspec

    "name": "UITestKit",
    "version": "0.1.2",
    "summary": "Programmatic UI Tests (not using the Apple UI Test Framework).  XCTest-based tests.",
    "description": "This library solves the problem of having to maintain Apple's UI Tests, but lets you automate UI Tests fornintegration testing.  By using this library, you are no longer subject to the limitations of the UI Testsnthat Apple provides a framework for.  You can run UI Tests as part of a normal Unit Test target.  The strategynis similar to many other language UI Testing frameworks, timers and conditional checks.  See the example projectnto see how it starts you off.nnI wrote this library, because it's the basic building blocks that I've used in so many iOS projects now.nI've had issues with the Apple UI Test framework and it's time to apply the DRY (Don't Repeat Yourself)nprinciple.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Eric Internicola": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.1.2"
    "social_media_url": "",
    "platforms": {
        "ios": "9.0"
    "swift_version": "4.2",
    "source_files": "UITestKit/**/*",
    "frameworks": "XCTest"

Pin It on Pinterest

Share This