New to fastlane? Click here to open the installation & setup instructions first

1) Install the latest Xcode command line tools

xcode-select --install

2) Install fastlane

# Using RubyGems
sudo gem install fastlane -NV

# Alternatively using Homebrew
brew install fastlane

3) Navigate to your project and run

fastlane init

More Details

Running iOS tests using fastlane

To run your unit tests or UI tests using fastlane, add the following to your Fastfile

lane :tests do
  run_tests(scheme: "MyAppTests")

Additionally you can specify more options for building and testing your app, for example

lane :tests do
  run_tests(workspace: "Example.xcworkspace",
            devices: ["iPhone 6s", "iPad Air"],
            scheme: "MyAppTests")

Check out the list of all available parameters

To use the newly created lane, just run

fastlane tests

Setting up fastlane to run on CI

To run iOS tests using fastlane on a Continuous Integration service, check out the Continuous Integration docs.

Since fastlane stores all configuration in simple configuration files, and runs via the command line, it supports every kind of CI system.

We also prepared some docs to help you get started with some of the popular CI systems.

Self-Hosted CIs

Hosted CIs

If your CI system isn't listed here, no problem, fastlane runs on any CI. To trigger fastlane, just add the command you would usually run from your terminal:

fastlane tests

Setting up the environment

Posting build results

If you want to post test results on Slack, Hipchat or other team chat client, check out the available fastlane actions.

Build failures


If you're using Slack, this is already built-into the default run_tests action, just provide your Slack URL:

lane :tests do
  run_tests(scheme: "MyAppTests",
            slack_url: "",
            slack_channel: "#channel")

To get the slack_url, create an Incoming WebHook for your Slack group.

Other services

To post a message when fastlane encounters a test or build failure, add the following to your Fastfile:

error do |ex|
  hipchat(message: "Tests have failed!",
          channel: "Room or @username",
          success: false)

The above example uses Hipchat, but fastlane supports many other services out there.