Firebase Test Lab lets you test your iOS app on multiple devices, right from the Firebase console. Keep reading to find out how to get started.
Create a Firebase project
If you don't have a Firebase project for your app, go to the Firebase console and click Create New Project to create one now. You will need ownership or edit permissions in your project.
You can use Test Lab for a limited number of daily test executions on the Spark and Flame plans. To use Test Lab without daily quota limits, you must upgrade to the Firebase Blaze plan.
Build XCTests for your app
There are three things you need to do to build iOS tests in a Test Lab-compatible format:
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:
- Open your project in Xcode.
- In the macOS menu bar, select File > 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.
Build generic test files
Test Lab runs unit tests and UI tests using the XCTest framework. To run your app's XCTests on Test 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.
Compress the test files for upload
Finally, package your test for upload
to Test Lab by compressing the test files you built into a
- Open finder, and navigate to the directory you designated for Derived Data output.
- Open the folder for your project, then the
Build/Productsfolders inside it.
- You should see a folder
PROJECT_NAME_iphoneosDEVELOPMENT_TARGET-arm64.xctestrun. Select them both, then right-click on one of them and select Compress 2 items.
Run your tests
Once you have an XCTest
.zip file, you're ready to start testing:
- Open Test Lab in the Firebase console.
- If it's your first test, click Get Started under iOS. If it isn't, click Run a Test, and select Run an XCTest.
- Click Browse, and find the
.zipfile you created.
- Check the box for each device and version you'd like to test on.
- Click Start Tests.
Investigate your test results
When the test starts, you're automatically redirected to the test results page. Tests can take a number of minutes to run, depending on the number of different configurations you have selected and the test timeout duration set for your tests. After your tests have run, you can review test results. See Analyzing Firebase Test Lab Results to learn more about how to interpret the test results.