Firebase Remote Config and Test Lab

2a37bf1e025cc1523124774c760df91a?s=47 Rebecca Franks
September 26, 2016

Firebase Remote Config and Test Lab

This presentation was given at Google Developer Launchpad in Nairobi on the 26 September 2016. It covers using Firebase remote config in your project with AB testing, staged rollout of features and using test lab in your projects.

2a37bf1e025cc1523124774c760df91a?s=128

Rebecca Franks

September 26, 2016
Tweet

Transcript

  1. 1.

    #LaunchpadDev Remote Config & Test Lab Rebecca Franks Google Developer

    Expert - Android / Senior Android Developer @ DVT @riggaroo riggaroo.co.za
  2. 2.

    Agenda • Remote Config • Setup & Basic Usage •

    Conditions • A/B Testing • Staged Rollouts • Test Lab • Robo Tests • Instrumentation Tests
  3. 4.

    • Key / Value Pairs saved on Firebase server •

    Change behaviour at runtime • No app update required Remote Config
  4. 5.

    Features • Quickly deploy changes • Customise your app for

    segments of user base • Run A/B Tests • Free!
  5. 8.

    Android Setup Project Level build.gradle: buildscript { // ... dependencies

    { // ... classpath 'com.google.gms:google-services:3.0.0' } }
  6. 9.

    Android Setup App Level app/build.gradle: dependencies { // ... compile

    'com.google.firebase:firebase-core:9.4.0' compile 'com.google.firebase:firebase-config:9.4.0' } // At the bottom apply plugin: 'com.google.gms.google-services'
  7. 10.

    Android Setup • Download google-services.json • Place in app/ folder.

    • Create remote config defaults file - res/xml/ remote_config.xml <?xml version="1.0" encoding="utf-8"?> <defaultsMap> <entry> <key>welcome_message</key> <value>Hello User!</value> </entry> </defaultsMap>
  8. 11.

    Initialise Firebase Remote Config remoteConfig = FirebaseRemoteConfig.getInstance(); FirebaseRemoteConfigSettings config =

    new FirebaseRemoteConfigSettings.Builder() .setDeveloperModeEnabled(BuildConfig.DEBUG) .build(); remoteConfig.setConfigSettings(config); remoteConfig.setDefaults(R.xml.remote_config);
  9. 12.

    Fetch remoteConfig.fetch(CACHE_TIME_SECONDS).addOnComplete Listener(new OnCompleteListener<Void>() { }); @Override public void onComplete(@NonNull

    Task<Void> task) { if (task.isSuccessful()) { Log.d(TAG, "Fetch Succeeded"); remoteConfig.activateFetched(); } else { Log.d(TAG, "Fetch Failed"); } displayWelcomeMessage(); }
  10. 15.

    Types you can store on Remote Config • Strings •

    Integers • Booleans • Long • Double • Byte Arrays
  11. 16.

    Conditions • Powerful decision- making server • Target a group

    of app instances • Made up of one or more rules that must evaluate to true
  12. 19.

    Types of Conditionals • OS Type • App ID •

    Device in Region or Country • App Version • Language • Audience from Analytics • Random Percentile Priority? Can be reordered on “Conditions” tab.
  13. 20.

    A/B Testing & Feature Rollout • Experimenting with your UI

    • Different audiences receive different UI
  14. 22.

    A/B Testing - Android Setup String experiment = config.getString("experiment_variant"); FirebaseAnalytics.getInstance(this)

    .setUserProperty("Experiment", experiment); if (experiment.equals("variant_a")) { //.. } else if (experiment.equals("variant_b")) { //... } else { //.. }
  15. 24.

    Analytics Log your events + track in the Firebase Console

    buttonCheckout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View view) { //.. } }); firebaseAnalytics.logEvent(“CheckoutClicked”, new Bundle());
  16. 28.

    Gradual Feature Rollouts • Leverage “User in Random Percentile” feature

    • Gradually increase the value of the percentage • Rollout to more customers as you gain confidence
  17. 33.

    What is Firebase Test Lab? • Run tests at Googles

    Device Farm • Virtual Devices + Physical Devices • Robo Tests & Custom Instrumentation Tests • Pay per hour
  18. 35.

    Why run tests on Firebase? • History of results •

    Logs attached to each test • Screenshots & videos • Don’t have to manage your own device farm
  19. 36.

    Robo Test • Random clicking around in your application +

    recording results • No code changes required to run a Robo Test • Uses Monkey Runner
  20. 40.

    Instrumentation Tests • Need to be writing test code •

    Espresso • Robotium • UIAutomator
  21. 41.
  22. 42.
  23. 45.

    Recap •Remote Config •Getting setup •Using remote config •A/B Testing

    + Gradual Roll outs •Test Lab •Robo Tests •Instrumentation tests
  24. 46.

    Thank you! Rebecca Franks Google Developer Expert - Android @riggaroo

    / +RebeccaFranksSA riggaroo.co.za #LaunchpadDev
  25. 47.

    Links Firebase Remote Config - https://firebase.google.com/docs/remote-config/ Firebase Test Lab -

    https://firebase.google.com/docs/test-lab/ Testing Support Library - https://developer.android.com/topic/libraries/ testing-support-library/index.html Demo Remote Config Project - https://github.com/riggaroo/remote-config- demo-ssa-launchpad-2016 Demo Test Lab Project - https://github.com/googlesamples/android- testing/tree/master/ui/uiautomator/BasicSample