Skip to content

Create test build and run XCTest

Yuxing Hu edited this page Mar 17, 2023 · 5 revisions

This guide describes how to prepare an XCTest for testing in Hydra Lab.

Step 1: Configure your project's Derived Data location

Xcode places compiled iOS artifacts, including any tests you build, in a Derived Data directory. It is possible to keep the default location for that directory, if you'd like, but it's often helpful to choose a more easily-accessible place for the files, especially if you're going to be running tests with Test Lab often:

  1. Open your project in Xcode.
  2. In the macOS menu bar, select File > Workspace Settings(or Project Settings)...
  3. Change the Derived Data dropdown from Default Location to Custom Location.
  4. In the field below the dropdown, select a location for Xcode to output your tests to.
image

Step 2: Build a generic test file

Hydra Lab runs unit tests and UI tests using the XCTest framework. To run your app's XCTests on Hydra Lab devices, build it for testing on a Generic iOS Device:

  1. From the device dropdown at the top of your Xcode workspace window, select Generic iOS Device.
  2. In the macOS menu bar, select Product > Build For > Testing.
image
Clone this wiki locally