Coder Social home page Coder Social logo

firebasetestlab-android's Introduction

Firebase Test Lab Plugin for Android

Plugin version badge License

Introduction

Plugin for which integrates Firebase Test Lab with Android Project. Simplify running Android Tests on Firebase platform locally as well as on using Continuous integration.

Contributors

Available features

  • Automatic installation of gcloud command line tool
  • Creating tasks for testable buildType[By default it is debug. If you want to change it use testBuildType "buildTypeName"]
  • Creating tasks for every defined device and configuration separately [ including Instrumented / Robo tests ]
  • Creating tasks which runs all configurations at once
  • Ability to download tests results to specific location
  • Ability to clear directory inside bucket before test run
  • Instrumented tests sharding

Benefits

  • Readability
  • Simplicity
  • Remote and Local Testing
  • Compatible with Gradle 3.0
  • Instrumented Tests sharding for parallel test execution

Setup

  1. If you don't have a Firebase project for your app, go to the Firebase console and click Create New Project to create one now. You will need ownership or edit permissions in your project.

  2. Create a service account related with your firebase project with an Editor role in the Google Cloud Platform console - IAM/Service Accounts

  3. Copy Project ID from Google Cloud Platform console - HOME

  4. Add plugin to your root project build.gradle:

    buildscript {
        repositories {
            maven {
               url "https://plugins.gradle.org/m2/"
            }
        }
        dependencies {
            classpath "firebase.test.lab:plugin:X.X.X"
        }
    }
    
  5. Add configuration in your project build.gradle:

    apply plugin: 'firebase.test.lab'
    
    firebaseTestLab {
        keyFile = file("test-lab-key.json")
        googleProjectId = "your-project-app-id"
        devices {
            nexusEmulator {
                deviceIds = ["hammerhead"]
                androidApiLevels = [23]
            }
        }
    }

    List of available devices

  6. Run your instrumentations tests

    ./gradlew firebaseTestLabExecuteDebugInstrumentation

    Or run robo tests

    ./gradlew firebaseTestLabExecuteDebugRobo 

Advanced configuration

You can

// Setup firebase test lab plugin
firebaseTestLab {
    // REQUIRED obtain service key as described inside README
    keyFile = file("test-lab-key.json")
    // REQUIRED setup google project id ad described inside README
    googleProjectId = "your-project-app-id"

    // If you want you can ignore test failures
    // ignoreFailures = true

    // If you prefer you can use your custom google storage bucket for storing build sources and results
    // cloudBucketName = "your-custome-google-storage-bucket-name"
    // If not specified default is: a timestamp with a random suffix
    // cloudDirectoryName = "your-custome-directory-name"

    // If you prefer to install gcloud tool manually you can set path by
    // cloudSdkPath = "/user/cloud-sdk/bin"

    // If you want to change default gcloud installation path (default is in build/gcloud directory)
    // you can set environment variable `export CLOUDSDK_INSTALL_DIR=`/cache/your_directory/`

    // REQUIRED
    devices {
        // REQUIRED add at least one device
        nexusEmulator {
            // REQUIRED Choose at least one device id
            // you can list all available via `gcloud firebase test android models list` or look on https://firebase.google.com/docs/test-lab/images/gcloud-device-list.png
            deviceIds = ["hammerhead"]

            // REQUIRED Choose at least one API level
            // you can list all available via `gcloud firebase test android models list` for your device model
            androidApiLevels = [23]

            // You can test app in landscape and portrait
            // screenOrientations = [com.appunite.firebasetestlabplugin.model.ScreenOrientation.PORTRAIT, com.appunite.firebasetestlabplugin.model.ScreenOrientation.LANDSCAPE]

            // Choose language (default is `en`)
            // you can list all available via `gcloud firebase test android locales list`
            // locales = ["en"]

            // If you are using ABI splits you can filter selected abi
            // filterAbiSplits = true
            // abiSplits = ["armeabi-v7a", "arm64-v8a", "x86", "x86_64"]

            // If you are using ABI splits you can remove testing universal APK
            // testUniversalApk = false
            
            // For instrumented test you can specify number of shards, which allows to split all the tests for [numShards] times and execute them in parallel
            // numShards = 4

            // You can set timeout (in seconds) for test
            // timeout = 6000

            // Enable Android Test Orchestrator more info at: https://developer.android.com/training/testing/junit-runner
            // isUseOrchestrator = true // default false

            // A list of one or more test target filters to apply (default: run all test targets)
            // testTargets = ["size large"]

            // Environment variables are mirrored as extra options to the am instrument -e KEY1 VALUE1
            // environmentVariables = ["clearPackageData=true", "coverage=true"]

            // The fully-qualified class name of the instrumentation test runner
            // testRunnerClass = "com.my.package.MyRunner"

            // Pass any custom param for gcloud
            // customParamsForGCloudTool = --no-performance-metrics
        }
        // You can define more devices
        someOtherDevices {
            deviceIds = ["shamu", "flounder"]
            androidApiLevels = [21]
        }
    }
}

For more precise test selection run

./gradlew tasks 

to discover all available test options

firebasetestlab-android's People

Contributors

himamis avatar ikesyo avatar jacek-marchwicki avatar piotrmadry avatar przem-appunite avatar przemyslaw-sf avatar zbynek avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.