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. Specifically, Device Farm supports XCTest tests that are written in Objective-C and Swift.

What Is XCTest?

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.

Keep It Functional (KIF) is a related iOS integration test framework. It allows for easy automation of iOS apps by leveraging the accessibility attributes available from the operating system 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

Your iOS XCTest tests must be in a .zip file that contains your my-project-name.xctest directory at the root The OS XCTest bundle must be located n this my-project-name.xctest directory.

Upload Your iOS XCTest Tests

Use the Device Farm console to upload your tests.

  1. Sign in to the Device Farm console at https://console.aws.amazon.com/devicefarm.

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

    Tip

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

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

  3. If the Create a new run button is displayed, 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.

    Note

    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.

  9. Choose Next step, and then complete the remaining instructions to select the devices to run your tests on and 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 captures screenshots after any failed steps during your tests. These reenshots are included in your Device Farm report. If you nt to take on-demand screenshots n your tests, call the captureScreenshotWithDescription method.

Additional Considerations for iOS XCTest Tests

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