Home

Awesome

TestFairy Gradle Plugin Build Status License

This plugin integrates TestFairy platform with the Gradle build system. With this plugin, you can upload signed builds directly via command line, IntelliJ, Android Studio and other IDEs.

Installation

A typical TestFairy Gradle Plugin installation takes less than 1 minute.

Installation consists of adding the following lines to your build.gradle files:

// Project's build.gradle
buildscript {
    repositories {
        maven { url 'https://www.testfairy.com/maven' }
    }
    dependencies {
        classpath 'com.testfairy.plugins.gradle:testfairy:3.+'
    }
}

// App module's build.gradle
apply plugin: 'testfairy'
testfairyConfig {
    apiKey "1234567890abcdef"
    uploadProguardMapping true    
}

NOTE: Your TestFairy API key is in your account settings

Usage

With the plugin installed, a set of new tasks, prefixed "testfairy" will be added, one for each build type.

For example: to upload a debug build, run the following from terminal:

gradlew testfairyDebug

Optionally, you can add a changelog to this build. This changelog will appear in your build notes and as a default message when inviting testers. For example:

gradlew -PtestfairyChangelog="Fixed all bugs" testfairyDebug

Similarly, you can also tag your releases like below. Tags given like this are merged with others from the plugin configuration.

gradlew -PtestfairyTags="feature1,feature2,alpha" testfairyDebug

Uploading Crash Symbols

Android projects using native libraries are likely to turn on compiler flags which strip symbol names from the final binaries. In release builds, these configurations result in crash reports with illegible stack trace lines. In order to reveal the symbols in a stripped build's crash report, you must upload a collection of your symbols to TestFairy.

With the plugin installed, a set of new tasks, prefixed "testfairyNdk" will be added, one for each build type.

Additional Parameters

This Gradle plugin uploads APK artifacts to TestFairy for distribution. We strongly suggest you also integrate the TestFairy SDK. Additional parameters control the default behavior of newly uploaded builds:

PropertyDescription
apiKeyAPI key used for uploading
videoShould record video? Values: on/off/wifi (default: on)
videoQualityImage quality of video. Values: high/medium/low (default: medium)
testersGroupsComma seperated list of testers-groups to invite
notifyShould send emails to these testers? Values: true/false (default: true)
autoUpdateDisplay and enable auto update for testers using older versions? Values: true/false (default: false)
recordOnBackgroundShould record metrics even if app is in background (Android only)? Values: true/false (default: false)
tagsComma separated list of tag strings which will be attached to current build

Using a Web Proxy

Behind a firewall at work? TestFairy Gradle Plugin supports HTTP proxy via "http.proxyHost" system property. Please refer to the Accessing The Web Via a Proxy section in the Gradle user guide document.

Android Studio / IntelliJ

This plugin is also Android Studio and Intellij-friendly. To upload builds directly from your IDE:

  1. Open "Edit Configuration..." dialog

Edit Configuration screenshot

  1. Add a new Gradle configuration, use task "testfairyDebug" or another, depending on your build type.

Add new Gradle configuration screenshot

<a name="migrate_2x"></a> Migrating from 2.x to 3.x

Version 3.0 deprecated the support for gradle plugins older than 3.4 and Android Studio build tools older than 5.1.1.

To migrate, simply upgrade those dependencies in your module's build.gradle and gradle-wrapper.properties files.

<a name="migrate_1x"></a> Migrating from 1.x to 2.x

Version 2.0 deprecated the support for instrumentation. Please use the TestFairy SDK to record sessions, auto-update versions, and handle crashes.

To migrate, simply re-integrate the plugin into your module's build.gradle file.

Changelog

3.6 (2021-12-20)

3.5 (2020-01-20)

3.4 (2020-01-16)

3.3 (2019-12-31)

3.2 (2019-12-05)

3.0 (2019-05-20)

2.0 (2017-09-01)

1.12 (2015-02-04)

Development

To test the plugin after code change, run:

export TF_API_KEY=${{ secrets.TF_API_KEY }}

./gradlew uploadArchives
cd example/TestApplication
./gradlew testfairyDebug

Bugs

Please send bug reports to support@testfairy.com