Test your app with Firebase Test Lab with ease using fastlane
Switch branches/tags
Nothing to show
Clone or download
MartyCatawiki and powerivq Xcode 10.1.0 fix (#55)
* Since XCode 10.1.0 the 'scheme count' counts one scheme more then exists, but the check is not necessary at all, so it's removed

* Remove the code that i commented

* Removed too much, put reading the XML file back

* Re-added scheme size check, now counting one less if key "__xctestrun_metadata__" is found

* Indentation
Latest commit 685132e Nov 23, 2018

README.md

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