mozilla
Your Search Results

    Marionette Test Runner

    The Marionette Test Runner is a Python test runner for Marionette tests. It is maintained as runtests.py, and the command-line options for this script are available via:

    python runtests.py --help

    Running tests against an emulator or device

    To have Marionette launch an emulator for you and run tests on that emulator, you specify the --emulator option.  The emulator will be closed when the tests are done.  If you specify --emulator you must also specify --homedir, as Marionette will locate adb relative to the homedir.

    To have Marionette connect to an actual device, you omit --emulator and specify --address=ADDRESS, where ADDRESS is the host:port that Marionette can connect to.  Marionette runs on port 2828 by default, but you'll have to setup port forwarding using adb so that the Marionette client can connect to port 2828 on the device.

    adb forward tcp:2828 tcp:2828

    To have Marionette connect to an emulator which you've already launched, you specify both the --emulator and --address options.

    Running tests against desktop builds

    To have Marionette launch a desktop application such as Firefox or the Firefox OS simulator, you specify the --binary option. The application will be closed when the tests are done. If you want to use a specific profile you can also specify the --profile option.

    If you are testing against the Firefox OS simulator you should also specify the --app=b2gdesktop option to ensure the correct preferences are set.

    To have Marionette connect to a desktop application which you've already launched, you must specify the --address option.

    Specifying tests to run

    To specify tests to run, you can specify one or more individual files, one or more directories, or a manifest file.

    When specifying directories, Marionette will attempt to run all files contained therein beginning with test_ or browser_ and ending with .py or .js extensions.

    When specifying a manifest file, you can also specify a --type=TYPE option. This controls what type of tests from the manifest are run.  TYPE can be any combination of values listed in the manifest file, combined with + or - symbols.  For instance, to run tests which are compatible with both the browser and b2g, you could specify --type=browser+b2g.  To specify tests which are compatible with b2g and do not require an emulator, you could specify --type=b2g-qemu.

    Test variables

    The --testvars option allows you to specify a path to a JSON file with variables that can be used by your tests.

    Examples

    To run a specific test on a device which has local port 2828 forwarded to port 2828 on the device, use:

    python runtests.py --address=localhost:2828 /path/to/test
    

    To run all the tests in a specific directory on a new emulator which Marionette launches, use:

    python runtests.py --emulator arm --homedir=/path/to/B2G /path/to/testdir
    

    To run a specific test on an emulator which you've already launched and set port forwarding on, use:

    python runtests.py --emulator arm --address=localhost:2828 --homedir=/path/to/B2G /path/to/test
    

    To have Marionette launch an emulator and execute all tests from the master manifest that are compatible with B2G, use:

    python runtests.py --emulator arm --homedir /path/toB2G --type=b2g tests/unit-tests.ini

    To have Marionette launch a Firefox OS simulator and run a specific test against it, use:

    python runtests.py --app=b2gdesktop --binary=/path/to/b2g-bin --profile=/path/to/gaia/profile /path/to/test

    Document Tags and Contributors

    Contributors to this page: jgriffin, davehunt, Tingyu
    Last updated by: Tingyu,