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
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")
end
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")
end
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 or other team chat client, check out the available fastlane actions.
Build failures
To post a message when fastlane encounters a test or build failure, add the following to your Fastfile
:
error do |lane, exception|
# Call here an action to post a message to your team chat.
end
For a full list of the available notification actions, check out the notifications section.