-
Notifications
You must be signed in to change notification settings - Fork 102
Create test build and run XCTest
This guide describes preparing an XCTest for testing in Hydra Lab.
Xcode places compiled iOS artifacts in a Derived Data directory, including any tests you build. 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 Hydra Lab often:
- Open your project in Xcode.
- In the macOS menu bar, select File > Workspace Settings(or Project Settings)...
- Change the Derived Data dropdown from Default Location to Custom Location.
- In the field below the dropdown, select a location for Xcode to output your tests to.

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:
- From the device dropdown at the top of your Xcode workspace window, select Generic iOS Device.
- In the macOS menu bar, select Product > Build For > Testing.

Finally, build and package your test for upload to Hydra Lab by compressing the test files you built into a .zip file.
- To build your XCTest, use the following command in a terminal (take workspace as an example):
xcodebuild -workspace PATH/TO/YOUR_WORKSPACE.xcworkspace \
-scheme YOUR_SCHEME \
-derivedDataPath FOLDER_WITH_TEST_OUTPUT \
-sdk iphoneos build-for-testing
- After your test successfully builds, zip it for upload to Hydra Lab:
cd FOLDER_WITH_TEST_OUTPUT/Build/Products : \
zip -r MyTests.zip Debug-iphoneos YOUR_SCHEME_iphoneosDEPLOYMENT_TARGET-arm64.xctestrun
You can also package up your test by compressing the test files manually, be sure to select the folders Debug-iphoneos and PROJECT_NAME_iphoneosDEVELOPMENT_TARGET-arm64.xctestrun and then compress them.

Before running your test with Hydra Lab, you can run it locally with a USB-connected device to quality check its behavior:
xcodebuild test-without-building \
-xctestrun "Derived Data/Build/Products/YourApp.xctestrun" \
-destination id=your-phone-id
After you successfully extract the zip file, it's time to submit it to Hydra Lab.
- Select Runner from the left panel
- Click the upload button to submit the zip file
You should see your package (this may take some time if your zip is relatively large) displayed on the table.
- Select Runner from the left panel
- Find the zip package you just uploaded in the table
- Click the run button, choose XCTest as the test type
- Choose the target machine (we only support real devices for now), and run the test
The result will be displayed in the task panel.
Introduction:
User manual:
- Deploy Center Docker Container
- Deploy Agent Docker Container
- Test agent setup
- One-Line-Installer Agent Setup
- [DEPRECATED]Deploy a test agent service
- Trigger a test task run in the Hydra Lab test service
- Create an Appium UI Test Automation Project
- Create test build and run XCTest
- Test Task Customization
- FAQ
Developer guideline:
- Start Services with Default Configuration
- Dev Environment Setup
- Technical Design
- Integrate Hydra Lab test center with Microsoft AAD authentication service
- Upgrade the test agent service from center service
News: