mozmill — Full automation of XULRunner applications.

Command Line Usage

The mozmill command line is versatile and includes a fair amount of debugging options. Even though all these options are available mozmill should run by default without any arguments and find your locally installed Firefox and run with mozmill.

In most modes, ctrl-c will shut down Firefox and exit out of the mozmill Python side as well.

$ mozmill
-h, --help
Show help message.
-b <binary>, --binary <binary>

Specify application binary location.

Default mozrunner.Profile and mozrunner.Runner are still mozrunner.FirefoxProfile and mozrunner.FirefoxRunner. You can change this by creating your own command line utility by subclassing CLI

-d <defaultprofile>
Specify the path to the default clean profile used to create new profiles.
-n, --no-new-profile
Do not create a new fresh profile.
-p <profile>, --profile <profile>
Specifies a profile to use. Must be used with –no-new-profile.
-w <plugins>, --plugins <plugins>

Comma seperated list of additional paths to plugins to install.

Plugins can be either .xpi zip compressed extensions or deflated extension directories.

-l <logfile>, --logfile <logfile>
Log all events to logfile.
--report <uri>

Currently in development.

POST results to given brasstacks results server at uri.

-t <test>, --test <test>
Run test. Can be either single test file or directory of tests.
--showall
Show all test output.
-D, --debug
Install debugging extensions and run with -jsconole
--show-errors
Print all logger errors to the console. When running tests only test failures and skipped tests are printed, this option print all other errors.
-s, --shell
Starts a Python shell for debugging.
-u, --usecode
By default –shell mode will use iPython if install and fall back to using the code module. This option forces the use of the code module instead of iPython even when installed.
-P <port>, --port <port>
Specify port for jsbridge.

Command Line Class

class mozmill.CLI

Inherits from jsbridge.CLI which inherits from mozrunner.CLI.

All the heavy lifting is handled by jsbridge and mozrunner. If you are subclassing this in order to creat a new command line interface be sure to call super() on all related methods.

runner_class
Default runner class. Should be subclass of mozrunner.Runner. Defaults to mozrunner.FirefoxRunner.
profile_class
Default profile class. Should be subclass of mozruner.Profile. Defaults to mozrunner.FirefoxProfile.

Running MozMill from Python

class mozmill.MozMill([runner_class[, profile_class[, jsbridge_port]]])

Manages an instance of Firefox w/ jsbridge and provides facilities for running tests and keeping track of results with callback methods.

Default runner_class is mozrunner.FirefoxRunner. Value should be a subclass of mozrunner.Runner.

Default profile_class is mozrunner.FirefoxProfile. Value should be a subclass of mozrunner.Profile.

Default jsbridge_port is 24242.

runner_class
Set during initialization to subclass of mozrunner.Runner.
profile_class
Set during initialization to subclass of mozrunner.Profile.
jsbridge_port
Set during initialization to numbers.Integral.
start([profile[, runner]])

Start mozrunner and jsbridge pre-requisites.

profile should be an instance of a mozrunner.Profile subclass. If one is not passed an instance of self.profile_class is created. self.profile will be set to this value.

runner should be an instance of a mozrunner.Runner subclass. If one is not passed an instance of runner_class will be created. runner will be set to this value.

This method will also run runner.start() and mozrunner.wait_and_create_network() and sets back_channel and bridge to instances of jsbridge.BackChannel and jsbridge.Bridge respectively.

profile
Set during start() to subclass of mozrunner.Profile.
runner
Set during start() to subclass of mozrunner.Runner.
back_channel
Set during start() to subclass of jsbridge.BackChannel.
bridge
Set during start() to subclass of jsbridge.Bridge
run_tests(test[, report])

Run test in live Firefox using bridge.

Adds local listeners endTest_listener() and endRunner_listener() to “endTest” and “endRunner” events using jsbridge.BackChannel.add_listener() of back_channel.

When tests are done the results are posted to a results server at report if passed.

endTest_listener(test)
When a test is finished the test object will be passed to this callback.
endRunner_listener(obj)
When all the tests are done running this callback will be fired.