No release in over a year
Run Android/iOS integration tests on Firebase Test Lab
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Project Readme

Fastlane

logo
Comprehensive and easy to use fastlane plugin for Firebase Test Lab integration. Supports both Android and iOS.

Features | Getting Started | Installation | Issues & Feedback | Troubleshooting | Contributing | License

Features

  1. Supports both Android and iOS with consistent API
  2. No gem dependencies (no issues in the future with incompatibility with other gem versions)
  3. Expandable API (you can add your own parameters to the plugin that are passed to underlying gcloud command)
  4. Unit(80%+) & Integration tests on Firebase Test Lab for Android/iOS
  5. Post test results as a comment to Github PRs (example PR)

This fastlane plugin includes the following actions:

Action Description Supported Platforms
firebase_test_lab_android Runs Firebase Test Lab for Android APK android
firebase_test_lab_ios Runs Firebase Test Lab for iOS XCTest ad XCUITest ios

Parameters

Here is the list of all existing parameters for the actions:

firebase_test_lab_android

Key & Env Var Description
gcp_project
FIREBASE_TEST_LAB_INTEGRATION_GCP_PROJECT
Google Cloud Platform project ID
gcp_key_file
FIREBASE_TEST_LAB_INTEGRATION_GCP_KEY_FILE
Google Cloud Platform authentication key file path
gcloud_channel
FIREBASE_TEST_LAB_INTEGRATION_GCP_CHANNEL
If you use beta or alpha channel. Defaults to stable (alpha/beta)
gcloud_results_bucket
FIREBASE_TEST_LAB_INTEGRATION_GCP_RESULTS_BUCKET
Name of Google Storage for Firebase Test Lab results bucket. Defaults to 'gcp_project_firebase_testlab'
gcloud_results_dir
FIREBASE_TEST_LAB_INTEGRATION_GCP_RESULTS_DIR
Name of Google Storage for Firebase Test Lab results directory. Defaults to firebase_test_lab_result_#{DateTime.now.strftime('%Y-%m-%d-%H:%M:%S')}
results_download_dir
FIREBASE_TEST_LAB_INTEGRATION_RESULTS_DOWNLOAD_DIR
Target directory to download screenshots from Firebase.
results_log_file_name
FIREBASE_TEST_LAB_INTEGRATION_OUTPUT_LOG_FILE_NAME
The filename to save the output results. Default: ./firebase_test_lab_integration.log
timeout
FIREBASE_TEST_LAB_INTEGRATION_TIMEOUT
The max time this test execution can run before it is cancelled. Default: 5m (this value must be greater than or equal to 1m)
type
FIREBASE_TEST_LAB_INTEGRATION_TYPE
The type of the test, one of: instrumentation, robo, game-loop, or xctest.
quiet
FIREBASE_TEST_LAB_INTEGRATION_QUIET
Mutes all potentially sensitive gcloud, gsutil output
app_path
FIREBASE_TEST_LAB_INTEGRATION_APP_PATH
The path to the app to be tested.
app_path_test
FIREBASE_TEST_LAB_INTEGRATION_APP_PATH_TEST
The path for your Android test APK. If not present assuming robo test if no type parameter specified.
devices
`
List of devices to test. Defaults to {model: "redfin",version: "30",locale: "en_US",orientation: "portrait"}
github_owner
GH_OWNER
Github Owner name of the repo
github_repository
GH_REPOSITORY
Github Repository name
github_pr_number
GH_PR_NUMBER
Github Pull request number
github_api_token
GH_API_TOKEN
GitHub API Token
extra_options
FIREBASE_TEST_LAB_INTEGRATION_EXTRA_OPTIONS
Extra options that you may pass directly to the gcloud command. Default: empty string"

firebase_test_lab_android

Key & Env Var Description
gcp_project
FIREBASE_TEST_LAB_INTEGRATION_GCP_PROJECT
Google Cloud Platform project ID
gcp_key_file
FIREBASE_TEST_LAB_INTEGRATION_GCP_KEY_FILE
Google Cloud Platform authentication key file path
gcloud_channel
FIREBASE_TEST_LAB_INTEGRATION_GCP_CHANNEL
If you use beta or alpha channel. Defaults to stable (alpha/beta)
gcloud_results_bucket
FIREBASE_TEST_LAB_INTEGRATION_GCP_RESULTS_BUCKET
Name of Google Storage for Firebase Test Lab results bucket. Defaults to 'gcp_project_firebase_testlab'
gcloud_results_dir
FIREBASE_TEST_LAB_INTEGRATION_GCP_RESULTS_DIR
Name of Google Storage for Firebase Test Lab results directory
results_download_dir
FIREBASE_TEST_LAB_INTEGRATION_RESULTS_DOWNLOAD_DIR
Target directory to download screenshots from Firebase.
results_log_file_name
FIREBASE_TEST_LAB_INTEGRATION_OUTPUT_LOG_FILE_NAME
The filename to save the output results. Default: ./firebase_test_lab_integration.log
timeout
FIREBASE_TEST_LAB_INTEGRATION_TIMEOUT
The max time this test execution can run before it is cancelled. Default: 5m (this value must be greater than or equal to 1m)
type
FIREBASE_TEST_LAB_INTEGRATION_TYPE
The type of the test, one of: instrumentation, robo, game-loop, or xctest.
quiet
FIREBASE_TEST_LAB_INTEGRATION_QUIET
Mutes all potentially sensitive gcloud, gsutil output. If you want to mute gcloud firebase test command as well pass extra_options: --no-user-output-enabled.
app_path
FIREBASE_TEST_LAB_INTEGRATION_APP_PATH
The path to the app to be tested.
devices
`
List of devices to test Defaults to {model: "iphone13pro",version: "15.2",locale: "en_US",orientation: "portrait"}
github_owner
GH_OWNER
Github Owner name of the repo
github_repository
GH_REPOSITORY
Github Repository name
github_pr_number
GH_PR_NUMBER
Github Pull request number
github_api_token
GH_API_TOKEN
GitHub API Token
extra_options
FIREBASE_TEST_LAB_INTEGRATION_EXTRA_OPTIONS
Extra options that you may pass directly to the gcloud command allowing full customization of what is executed beyond provided parameters. Default: empty string"

Getting Started

Step 1. Enable required Google Cloud API's

You need to grant the following two API's to your Google Cloud project:

Step 2. Create Google Cloud Service Account & Key

You need to create a Google Cloud Service Account with the Editor role and download the JSON key file.

Step 3. Add the Service Account Key to your project

Add the Service Account Key to your project by adding the following line to your Fastfile:

firebase_test_lab_android(
  ...
    gcp_key_file: "path/to/service_account_key.json"
  ...
)

Step 4. Add gcloud CLI in your environment

You need to add the gcloud CLI in your environment. You can either install it manually or use prebuild actions available in your CI environment.

For example in GitHub Actions you can use the following action:

- name: Setup gcloud CLI
  uses: google-github-actions/setup-gcloud@master
  with:
    version: 'latest'
    service_account_key: ${{ secrets.GCP_SA_KEY }}
    project_id: ${{ secrets.GCP_PROJECT_ID }}

or manually follow steps below

Step 5. Enable billing for your Google Cloud project in Firebase

You need to upgrade from basic Spark plan in Firebase on your project to be able to use all the required API components for Firebase Test Lab (such as Google Cloud Storage)

Step 6. Add plugin to your project

This project is a fastlane plugin. To get started with fastlane-plugin-firebase_test_lab_integration, add it to your project by running:

fastlane add_plugin firebase_test_lab_integration

Step 7. Find device model names

You can find the device model names as follows:

For Android firebase_test_lab_android command:

gcloud firebase test android models list

Alternatively you can see the list of devices here

For iOS firebase_test_lab_ios command:

gcloud firebase test ios models list

Alternatively you can see the list of devices here

Installation

This project is a fastlane plugin. To get started with fastlane-plugin-test_center, add it to your project by running:

fastlane add_plugin firebase_test_lab_integration

Example

Check out the example Fastfile to see how to use this plugin. Try it by cloning the repo, running bundle exec fastlane install_plugins and bundle exec fastlane test.

Run tests for this plugin

To run both the tests, and code style validation, run

bundle exec rake

To automatically fix many of the styling issues, use

bundle exec rubocop -a

Issues and Feedback

For any other issues and feedback about this plugin, please submit it to this repository.

Troubleshooting

If you have trouble using plugins, check out the Plugins Troubleshooting guide.

Using fastlane Plugins

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

About fastlane

fastlane is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out fastlane.tools.

Contributing

  1. Clone repo and create a new branch:
git checkout https://github.com/crisboarna/react-skillbars -b name_for_new_branch`.
  1. Make changes and test
  2. Submit Pull Request with comprehensive description of changes

Bots used

To facilitate development the following bots are integrated into the repository:

  1. Request Info
  2. Semantic Pull Requests
  3. Welcome
  4. Snyk
  5. Todo
  6. Codecov

Credits

Inspired from existing plugin with similar functionality for Android by @wasabeef.