Working with XCTest UI testing framework for iOS and AWS Device Farm - AWS Device Farm

Working with XCTest UI testing framework for iOS and AWS Device Farm

Device Farm provides support for XCTest UI testing framework for iOS. Specifically, Device Farm supports XCTest UI tests written in both Objective-C and Swift.

What is XCTest UI testing framework?

XCTest UI framework is the new testing framework introduced with Xcode 7. This framework extends XCTest with UI testing capabilities. For more information, see User Interface Testing in the iOS Developer Library.

Prepare your iOS XCTest UI tests

Your iOS XCTest UI test runner bundle must be contained in a properly formatted .ipa file.

To create an .ipa file, place your my-project-nameUITest-Runner.app bundle in an empty Payload directory. Next, archive the Payload directory into a .zip file and then change the file extension to .ipa. The *UITest-Runner.app bundle is produced by Xcode when you build your project for testing. It can be found in the Products directory for your project.

Upload your iOS XCTest UI 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. On the Device Farm navigation panel, choose Mobile Device Testing, then choose Projects.

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

    Tip

    You can use the search bar to filter the project list by name.

    To create a project, follow the instructions in Create a project in AWS Device Farm

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

  5. On the Choose application page, select Choose File.

  6. 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.

  7. Choose Next.

  8. On the Configure page, in the Setup test framework section, choose XCTest UI, and then select Choose File.

  9. Browse to and choose the .ipa file that contains your iOS XCTest UI test runner.

  10. Choose Next, and then complete the remaining instructions to select the devices to run your tests on and start the run.

Taking screenshots in iOS XCTest UI tests

XCTest UI tests capture screenshots automatically for every step of your tests. These screenshots are displayed in your Device Farm test report. No additional code is required.