Firefox OSのMarionetteの設定

Building Firefox OS with Marionette enabled

Marionette's server component is part of gecko, and is compiled into a B2G build when ENABLE_MARIONETTE=1 is present in your mozconfig.

For device builds (including the emulator), Marionette is enabled by default in all VARIANT=eng (engineering) builds. This is the default type of build created if you use ./ <config>, ./ Marionette is not included in VARIANT=user builds, which is the type of build QA normally uses for testing.

For B2G desktop builds, you'll need to add the line ENABLE_MARIONETTE=1 to your mozconfig before building.

Setting up the Marionette client

The Marionette client is a Python package with which you can run Marionette tests. You'll need to set this up on your machine before using it.

To do so, you can either install it from pypi:

$ pip install marionette_client

Or from a gecko build tree:

$ cd $GECKO_DIR/testing/marionette/client

$ python develop

You can perform these steps inside a virtualenv if you wish.

To verify Marionette is installed:

$ python

>>> from marionette import Marionette

Verifying Marionette is running

On a device

Please make sure the [Settings > Device Information > More Information >  Developer > Remote debugging] is OFF.

Connect your device to your computer and verify it appears in adb devices, then set up adb port forwarding to Marionette's port:

$ adb devices
List of devices attached
full_unagi    device

$ adb forward tcp:2828 tcp:2828

$ telnet localhost 2828
Connected to localhost.
Escape character is '^]'.
  "from": "root",
  "applicationType", "gecko",
  "traits": []

If you see the above output, Marionette is running on your device.

On an emulator

Launch the emulator using the ./ script, then follow the above steps.

On a B2G desktop build

For desktop B2G builds, you need to add an additional pref in order for Marionette to successfully run:  marionette.force-local = true.  You can add this pref in gaia/profile/user.js as user_pref("marionette.force-local", true), then re-build your gaia profile before starting the B2G desktop build.

When using a B2G desktop build, you don't need to use adb port forwarding. After launching the build, telnetting to localhost 2828 should result in the same output shown above.