Page tree
Skip to end of metadata
Go to start of metadata

Last updated: Jan 28, 2020 14:28

With fastlane, you can automate beta deployments and releases for iOS and Android apps. fastlane handles all involved tasks, such as generating screenshots, code signing, and releasing the application.

Get started

To set up fastlane, follow the instructions on how to install fastlane in the fastlane documentation.

Note: fastlane currently only runs on macOS.

1 | Install the plugin

The fastlane plugin for Perfecto allows you to automatically upload .ipa/.apk files to the Perfecto Media repository for testing of manual, automation, and developer tools in the Perfecto cloud. It is available as a ruby gem here: https://rubygems.org/gems/fastlane-plugin-perfecto

To install the plugin:

  1. Make sure Ruby and fastlane are already installed.
  2. Add the fastlane plugin to your project by running the following command:

    fastlane add_plugin perfecto

On this page:

2 | Use the plugin

For information on using the fastlane plugin, see this example Fastfile. Following is a sample action that you can add to your Fastfile to utilize the plugin.

lane :test do
  perfecto(
    perfecto_cloudurl: ENV["PERFECTO_CLOUDURL"],
    perfecto_token: ENV["PERFECTO_TOKEN"],
    perfecto_media_location: ENV["PERFECTO_MEDIA_LOCATION"],
    file_path: ENV['GRADLE_APK_OUTPUT_PATH']
  )
end

where:

  • PERFECTO_CLOUDURL is the URL of your Perfecto cloud, such as demo.perfectomobile.com
  • PERFECTO_TOKEN is your Perfecto security token
  • PERFECTO_MEDIA_LOCATION is the location of the Perfecto media repository to upload the file specified by the file_path key, such as PUBLIC:Samples/sample.ipa
  • file_path is the location of your preferred .ipa/.apk file to be uploaded to the Perfecto media repository

    Note: ENV['GRADLE_APK_OUTPUT_PATH'] is only applicable to Android projects.

You pass the values for these keys either by means of an .env file inside the fastlane folder or through environment variables.

The following image shows a sample .env file.

Combinations with other tools and integrations

You can use fastlane in combination with other tools and integrations that Perfecto offers. The following sample project demonstrates the usage of the fastlane plugin in an end-to-end integration of an Android build life cycle: https://github.com/PerfectoMobileSA/FastlaneEspressoCircleCISlackSample.

The life cycle includes:

  1. Generating the .apk builds
  2. Testing the builds on Perfecto
  3. Running the builds in CircleCI
  4. Getting instant, suite-level reporting to Slack
  5. Verifying the test results with Perfecto Smart Reporting

For steps, expand the following scenarios.


fastlane with Espresso
  1. Clone the sample project.
  2. In a terminal window, navigate to the project folder.
  3. Create a file called local.properties to contain an sdk.dir key pointing to your Android SDK location.
  4. Set up the .env file (see example above).
  5. Run the following commands:

    fastlane install_plugins
    bundle exec fastlane android test
fastlane with Espresso, CircleCI, and Slack (end-to-end integration of an Android build life cycle)
  1. Set up CircleCI. Use this sample CircleCI fastlane file as a reference.
    The config.yml file takes care of deploying the required installations, builds the .apk files, uploads to Perfecto, executes Espresso tests in the Perfecto cloud, and then sends the suite-level Smart Reporting link to Slack.
  2. Set up the following environment variables in CircleCI. For more information, see the CircleCI documentation on environment variables.

    • PERFECTO_CLOUDURL: The URL of your Perfecto cloud, such as demo.perfectomobile.com
    • PERFECTO_TOKEN: Your Perfecto security token
    • PERFECTO_MEDIA_LOCATION: The location of the Perfecto media repository to upload the file specified by the file_path key, such as PUBLIC:Samples/sample.ipa
    • slack_webhook: The incoming webhook for the Slack integration
      For more information, see the fastlane documentation on Slack.

The following images show the fastlane execution (with Espresso and Perfecto integration) in CircleCI, the report link in Slack, and the Perfecto report in the CI Dashboard view.