AWS Device Farm
Developer Guide (API Version 2015-06-23)

Working with XCTest for iOS and AWS Device Farm

Device Farm provides support for XCTest (including KIF) for iOS, written both Objective-C and Swift. The following information describes how to use this test framework with Device Farm test types.

What is XCTest (and KIF)?

XCTest is the new testing framework introduced with Xcode 5. XCTest is a modernized reimplementation of OCUnit, the previous-generation testing framework. For more information, see XCTest—the Xcode Testing Framework and Transitioning from OCUnit to XCTest in the Testing with Xcode section of the iOS Developer Library.

KIF (which stands for Keep It Functional) is a related iOS integration test framework. It allows for easy automation of iOS apps by leveraging the accessibility attributes that the operating system makes available for those with visual disabilities. KIF builds and performs the tests using a standard XCTest testing target. For more information, see the KIF iOS Integration Testing Framework repository on GitHub.

Prepare Your iOS XCTest Tests

Before you upload iOS XCTest tests to Device Farm for testing, make sure that your iOS XCTest tests are contained within a .zip file. This .zip file must contain your my-project-name.xctest directory at the root of the .zip file. The actual iOS XCTest bundle must be located within this my-project-name.xctest directory.

Upload Your iOS XCTest Tests

To run your iOS XCTest tests on a set of iOS devices in Device Farm, you upload your tests with the Device Farm console as follows:.

  1. Sign in to the Device Farm console at

  2. In the list of projects, choose the option next to the project that you want to upload your tests to.


    If the list of projects is not displayed, then on the secondary navigation bar, for Projects, choose the name of the project that you want to upload your tests to.

    To create a new project, follow the instructions in Create a Project.

  3. If the Create a new run button is displayed, then choose it.

  4. On the Choose your application page, choose Upload.

  5. Browse to and choose your iOS app file. The file must be an .ipa file.


    Make sure that your .ipa file is built for an iOS device and not for a simulator.

  6. Choose Next step.

  7. On the Configure a test page, choose XCTest, and then choose Upload.

  8. Browse to and choose the .zip file that contains your iOS XCTest tests. In this .zip file, make sure that the contents are organized according to the instructions as described in Prepare Your iOS XCTest Tests.

  9. Choose Next step, and then complete the remaining on-screen instructions to select the devices to run your tests on and to then start the run.

Taking Screenshots in iOS XCTest Tests

Device Farm currently supports taking screenshots as part of your iOS XCTest tests using KIF. By default, KIF will automatically capture screenshots after any failed steps during your tests, and these will be included in your Device Farm report. If you wish to take on-demand screenshots within your tests, you should call the captureScreenshotWithDescription method.

Additional Considerations for iOS XCTest Tests

Device Farm supports any version of KIF that is based on OCUnit or XCTest.

Device Farm supports XCTest tests that are written in Objective-C and Swift.