Latest 4.3.0
License Apache 2.0
Platforms ios 8.0, tvos 10.0

Fleet Build Status

Fleet is a UIKit-focused testing framework intended for use on iOS and tvOS projects written in Swift.


See the Installation section for details about installing Fleet in your iOS
or tvOS project.


Storyboard injection and mocking

Fleet allows test code to inject into and pull mocks from storyboards. This gives you the best of both worlds — ability to test
your view controllers and their interactions with each other exactly as they are in production code without compromising the ability
to isolate any particular view controller for unit testing purposes.

Read more about using Fleet’s storyboard features in the Documentation section.

Interaction with UIKit elements

Fleet extends UIKit classes in order to make it easier to test your code’s interactions with UIKit. Following are summaries of the major features for each extended class. The Documentation folder contains more information about these features, as well as sample code showing you how they are intended to be used.

  • UIViewController – Makes the UI run-loop behave more consistently to allow specs to test view controller presentation and dismissal with less effort.
  • UITableView – Provides methods mimicing user actions on table views, ensuring all appropriate delegate and data source callbacks are run.
  • UINavigationController – Allows specs to test pushing and popping on the navigation stack without waiting for the UI run-loop.
  • UIButton – Provides convenience methods for interacting with buttons in test.
  • UIBarButtonItem – Provides convenience methods similar to those provided for UIButton.
  • UIAlertController – Allows specs to simply tap on alert actions in order to test their behavior.
  • UITextField – Provides convenience methods for entering text. (iOS-only)
  • UISwitch – Provides convenience methods for interacting with switches in test. (iOS-only)
  • UITextView – Provides convenience methods for entering text into a text view. (iOS-only)

Setup for view controller tests

Fleet provides another method of help in setting up view controller alongside storyboard injection and mocking. It makes it easy
to set your view controllers up in a proper key application window by providing the following methods:

// Takes a `UIViewController`,  makes it the test app key window's root, and kicks off its lifecycle.

// Takes a `UIViewController`,  makes it the root of a navigation stack, kicks off the lifecycle, and
// returns the navigation controller that hosts that view controller.

Fleet highly recommends that all view controller tests run inside the test host’s key window using one of the above
methods. For more discussion on why, go to the relevant section in the FAQ.



To get you started with Fleet, we’ve created a real, working project that is fully test-driven with the help of Fleet, and which
contains many examples of basic tests that you’ll likely write in any Swift iOS application.

For more complicated, larger-scale projects that use Fleet, check out the following projects:


Latest podspec

    "name": "Fleet",
    "version": "4.3.0",
    "summary": "A UIKit-focused Swift testing framework",
    "homepage": "",
    "license": {
        "type": "Apache 2.0",
        "file": "LICENSE"
    "authors": "Jared Friese",
    "platforms": {
        "ios": "8.0",
        "tvos": "10.0"
    "source": {
        "git": "",
        "tag": "4.3.0"
    "source_files": "Fleet/**/*.{swift,h,m}",
    "public_header_files": [
    "preserve_paths": "Fleet/Script/",
    "tvos": {
        "exclude_files": [

Pin It on Pinterest

Share This