Repository is archived
No commit activity in last 3 years
No release in over 3 years
There's a lot of open issues
Test your app with Firebase Test Lab with ease using fastlane
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 2.102.0
<= 0.50.0

Runtime

>= 3.0.0
>= 1.0.0
>= 0.8.0, < 1.0.0
 Project Readme

Firebase Test Lab plugin for fastlane

This project is a fastlane plugin. You can add it to your fastlane project by running

fastlane add_plugin firebase_test_lab

fastlane Firebase Test Lab plugin

About Firebase Test Lab plugin

Firebase Test Lab let you easily test your iOS app (Android support forthcoming) on a variety of real or virtual devices and configurations. This plugin allows you to submit your app to Firebase Test Lab by adding an action into your Fastfile.

Getting started

If you are not current user of Firebase

You need to set up Firebase first. These only needs to be done once for an organization.

Configure Google credentials through service accounts

To authenticate, Google Cloud credentials will need to be set for any machine where fastlane and this plugin runs on.

If you are running this plugin on Google Cloud Compute Engine, Kubernetes Engine or App Engine flexible environment, a default service account is automatically provisioned. You will not need to create a service account. See this for more details.

In all other cases, you need to configure the service account manually. You can follow this guide on how to create a new service account and create a key for it. You will need to set the GOOGLE_APPLICATION_CREDENTIALS environment variable pointing to the service account key file according to the document.

No matter if you are a using an automatically provisioned service account or a manually created one, the service account must be configured to have the project editor role.

Enable relevant Google APIs

  • You need to enable the following APIs on your Google Cloud API library (see this for instructions how):
    1. Cloud Testing API
    2. Cloud Tool Results API

Find the devices you want to test on

If you have gcloud tool, you can run

gcloud beta firebase test ios models list

to get a list of supported devices and their identifiers.

Alternatively all available devices can also be seen here.

Actions

firebase_test_lab_ios_xctest

Submit your iOS app to Firebase Test Lab and run XCTest. Refer to this document for more details about Firebase Test Lab specific arguments.

scan(
  scheme: 'YourApp',                  # XCTest scheme
  clean: true,                        # Recommended: This would ensure the build would not include unnecessary files
  skip_detect_devices: true,          # Required
  build_for_testing: true,            # Required
  sdk: 'iphoneos',                    # Required
  should_zip_build_products: true     # Must be true to set the correct format for Firebase Test Lab
)
firebase_test_lab_ios_xctest(
  gcp_project: 'your-google-project', # Your Google Cloud project name
  devices: [                          # Device(s) to run tests on
    {
      ios_model_id: 'iphonex',        # Device model ID, see gcloud command above
      ios_version_id: '11.2',         # iOS version ID, see gcloud command above
      locale: 'en_US',                # Optional: default to en_US if not set
      orientation: 'portrait'         # Optional: default to portrait if not set
    }
  ]
)

Available parameters:

  • app_path: You may provide a different path in the local filesystem (e.g: /path/to/app-bundle.zip) or on Google Cloud Storage (gs://your-bucket/path/to/app-bundle.zip) that points to an app bundle as specified here. If a Google Cloud Storage path is used, the service account must have read access to such file.
  • gcp_project: The Google Cloud project name for Firebase Test Lab to run on.
  • gcp_requests_timeout: The timeout, in seconds, to use for all requests to the Google Cloud platform (e.g. uploading your app bundle ZIP). If this parameter is omitted, Google Cloud SDK's default requests timeout value will be used. If you are finding that your ZIP uploads are timing out due to the ZIP file being large and not completing within the set timeout time, increase this value.
  • gcp_additional_client_info: Additional information to include in the client information of your test job. For example, if you'd like to include metadata to use in a Google cloud function in response to your test job's outcome. See https://firebase.google.com/docs/reference/functions/functions.testLab.ClientInfo for more information.
  • oauth_key_file_path: The path to the Google Cloud service account key. If not set, the Google application default credential will be used.
  • devices: An array of devices for your app to be tested on. Each device is represented as a ruby hash, with ios_model_id, ios_version_id, locale and orientation properties, the first two of which are required. If not set, it will default to iPhone X on iOS 11.2. This array cannot be empty.
  • async: If set to true, the action will not wait for the test results but exit immediately.
  • timeout_sec: After how long will the test be abandoned by Firebase Test Lab. Duration should be given in seconds.
  • result_storage: Designate which location on Google Cloud Storage to store the test results. This should be a directory (e.g: gs://your-bucket/tests/)

Issues and Feedback

If you have any other issues and feedback about this plugin, we appreciate if you could submit an issue to this repository.

You can also join the Firebase slack channel here.

Troubleshooting

For some more detailed help with plugins problems, check out the Plugins Troubleshooting doc in the main fastlane repo.

Using fastlane Plugins

For more information about how the fastlane plugin system works, check out the Plugins documentation in the main fastlane repo.

About fastlane

fastlane automates building, testing, and releasing your app for beta and app store distributions. To learn more about fastlane, check out fastlane.tools.