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 Android tests using fastlane
To run your unit tests using fastlane, add the following to your Fastfile
lane :tests do
gradle(task: "test")
end
Replace "test"
with the gradle task name for running unit tests of your app.
Additionally you can specify more options for building and testing your app, 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 Android 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
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
Hipchat
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)
end
Other services
The above example uses Hipchat, but fastlane supports many other services out there.