Mobile/Fennec/Android/Switchboard: Difference between revisions

From MozillaWiki
< Mobile‎ | Fennec‎ | Android
Jump to navigation Jump to search
Line 14: Line 14:
To test your Switchboard changes locally, follow these steps. This assumes you have already forked and cloned the [https://github.com/mozilla-services/switchboard-experiments switchboard-experiments repo], and have made the local changes you want to test.
To test your Switchboard changes locally, follow these steps. This assumes you have already forked and cloned the [https://github.com/mozilla-services/switchboard-experiments switchboard-experiments repo], and have made the local changes you want to test.


# Clone the [https://github.com/mozilla-services/switchboard-server switchboard-server repo]
# git clone git@github.com:mozilla-services/switchboard-server.git (or your own fork)
# In the root of the server directory, run: npm install
# cd switchboard-server
# In the root of the server directory, run: `EXPERIMENTS_FILE=path/to/experiments.json node index.js`
# npm install
# EXPERIMENTS_FILE=path/to/your/experiments.json node index.js
# Get a URL for your local server (I used [https://localtunnel.me/ localtunnel])
# Get a URL for your local server (I used [https://localtunnel.me/ localtunnel])
# Update the Switchboard default server URLs in [http://hg.mozilla.org/mozilla-central/file/c0ba5835ca48/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java#l587 BrowserApp] to match your local server URL
# Update the Switchboard default server URLs in [http://hg.mozilla.org/mozilla-central/file/c0ba5835ca48/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java#l587 BrowserApp] to match your local server URL

Revision as of 20:43, 26 January 2016

Switchboard is a service we use to segment users for A/B testing.

Usage

To use Switchboard to expose a new feature to a portion of our users, use a code snippet like this:

 if (SwitchBoard.isInExperiment(this, "yourexperimentname")) {
   // Do something interesting.
 }

We also need to add the "yourexperimentname" name to the Switchboard server config.

Testing Switchboard changes locally

To test your Switchboard changes locally, follow these steps. This assumes you have already forked and cloned the switchboard-experiments repo, and have made the local changes you want to test.

  1. git clone git@github.com:mozilla-services/switchboard-server.git (or your own fork)
  2. cd switchboard-server
  3. npm install
  4. EXPERIMENTS_FILE=path/to/your/experiments.json node index.js
  5. Get a URL for your local server (I used localtunnel)
  6. Update the Switchboard default server URLs in BrowserApp to match your local server URL
  7. Rebuild and run Fennec

Examples