Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Firebase Remote Config and Test Lab

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.

Rebecca Franks

September 26, 2016
Tweet

More Decks by Rebecca Franks

Other Decks in Technology

Transcript

  1. #LaunchpadDev Remote Config & Test Lab Rebecca Franks Google Developer

    Expert - Android / Senior Android Developer @ DVT @riggaroo riggaroo.co.za
  2. Agenda • Remote Config • Setup & Basic Usage •

    Conditions • A/B Testing • Staged Rollouts • Test Lab • Robo Tests • Instrumentation Tests
  3. • Key / Value Pairs saved on Firebase server •

    Change behaviour at runtime • No app update required Remote Config
  4. Features • Quickly deploy changes • Customise your app for

    segments of user base • Run A/B Tests • Free!
  5. Android Setup Project Level build.gradle: buildscript { // ... dependencies

    { // ... classpath 'com.google.gms:google-services:3.0.0' } }
  6. 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. 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. 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. 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. Types you can store on Remote Config • Strings •

    Integers • Booleans • Long • Double • Byte Arrays
  11. Conditions • Powerful decision- making server • Target a group

    of app instances • Made up of one or more rules that must evaluate to true
  12. 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. A/B Testing & Feature Rollout • Experimenting with your UI

    • Different audiences receive different UI
  14. 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. 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. 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. What is Firebase Test Lab? • Run tests at Googles

    Device Farm • Virtual Devices + Physical Devices • Robo Tests & Custom Instrumentation Tests • Pay per hour
  18. 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. Robo Test • Random clicking around in your application +

    recording results • No code changes required to run a Robo Test • Uses Monkey Runner
  20. Instrumentation Tests • Need to be writing test code •

    Espresso • Robotium • UIAutomator
  21. Recap •Remote Config •Getting setup •Using remote config •A/B Testing

    + Gradual Roll outs •Test Lab •Robo Tests •Instrumentation tests
  22. Thank you! Rebecca Franks Google Developer Expert - Android @riggaroo

    / +RebeccaFranksSA riggaroo.co.za #LaunchpadDev
  23. 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