/testing/mozmill/mozmill/docs/index.rst

https://github.com/wisec/DOMinator · ReStructuredText · 188 lines · 106 code · 82 blank · 0 comment · 0 complexity · 3077d3fb602f461033d4a5753f400ecc MD5 · raw file

  1. :mod:`mozmill` --- Full automation of XULRunner applications.
  2. =============================================================
  3. .. module:: mozmill
  4. :synopsis: Full automation of XULRunner applications.
  5. .. moduleauthor:: Mikeal Rogers <mikeal.rogers@gmail.com>
  6. .. sectionauthor:: Mikeal Rogers <mikeal.rogers@gmail.com>
  7. Command Line Usage
  8. ------------------
  9. 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.
  10. In most modes, ctrl-c will shut down Firefox and exit out of the mozmill Python side as well.
  11. .. code-block:: none
  12. $ mozmill
  13. .. cmdoption:: -h, --help
  14. Show help message.
  15. .. cmdoption:: -b <binary>, --binary <binary>
  16. Specify application binary location.
  17. Default :class:`mozrunner.Profile` and :class:`mozrunner.Runner` are still
  18. :class:`mozrunner.FirefoxProfile` and :class:`mozrunner.FirefoxRunner`. You can
  19. change this by creating your own command line utility by subclassing :class:`CLI`
  20. .. cmdoption:: -d <defaultprofile>
  21. Specify the path to the default **clean** profile used to create new profiles.
  22. .. cmdoption:: -n, --no-new-profile
  23. Do not create a new fresh profile.
  24. .. cmdoption:: -p <profile>, --profile <profile>
  25. Specifies a profile to use. Must be used with --no-new-profile.
  26. .. cmdoption:: -w <plugins>, --plugins <plugins>
  27. Comma seperated list of additional paths to plugins to install.
  28. Plugins can be either .xpi zip compressed extensions or deflated extension directories.
  29. .. cmdoption:: -l <logfile>, --logfile <logfile>
  30. Log all events to *logfile*.
  31. .. cmdoption:: --report <uri>
  32. *Currently in development.*
  33. POST results to given brasstacks results server at *uri*.
  34. .. cmdoption:: -t <test>, --test <test>
  35. Run *test*. Can be either single test file or directory of tests.
  36. .. cmdoption:: --showall
  37. Show all test output.
  38. .. cmdoption:: -D, --debug
  39. Install debugging extensions and run with -jsconole
  40. .. cmdoption:: --show-errors
  41. Print all logger errors to the console. When running tests only test failures and skipped
  42. tests are printed, this option print all other errors.
  43. .. cmdoption:: -s, --shell
  44. Starts a Python shell for debugging.
  45. .. cmdoption:: -u, --usecode
  46. By default --shell mode will use iPython if install and fall back to using the code module.
  47. This option forces the use of the code module instead of iPython even when installed.
  48. .. cmdoption:: -P <port>, --port <port>
  49. Specify port for jsbridge.
  50. Command Line Class
  51. ------------------
  52. .. class:: CLI
  53. Inherits from :class:`jsbridge.CLI` which inherits from :class:`mozrunner.CLI`.
  54. All the heavy lifting is handled by jsbridge and mozrunner. If you are subclassing
  55. this in order to creat a new command line interface be sure to call :func:`super` on all
  56. related methods.
  57. .. attribute:: runner_class
  58. Default runner class. Should be subclass of :class:`mozrunner.Runner`.
  59. Defaults to :class:`mozrunner.FirefoxRunner`.
  60. .. attribute:: profile_class
  61. Default profile class. Should be subclass of :class:`mozruner.Profile`.
  62. Defaults to :class:`mozrunner.FirefoxProfile`.
  63. Running MozMill from Python
  64. ---------------------------
  65. .. class:: MozMill([runner_class[, profile_class[, jsbridge_port]]])
  66. Manages an instance of Firefox w/ jsbridge and provides facilities for running tests and
  67. keeping track of results with callback methods.
  68. Default *runner_class* is :class:`mozrunner.FirefoxRunner`. Value should be a subclass of
  69. :class:`mozrunner.Runner`.
  70. Default *profile_class* is :class:`mozrunner.FirefoxProfile`. Value should be a subclass of
  71. :class:`mozrunner.Profile`.
  72. Default *jsbridge_port* is `24242`.
  73. .. attribute:: runner_class
  74. Set during initialization to subclass of :class:`mozrunner.Runner`.
  75. .. attribute:: profile_class
  76. Set during initialization to subclass of :class:`mozrunner.Profile`.
  77. .. attribute:: jsbridge_port
  78. Set during initialization to :class:`numbers.Integral`.
  79. .. method:: start([profile[, runner]])
  80. Start mozrunner and jsbridge pre-requisites.
  81. *profile* should be an instance of a `mozrunner.Profile` subclass. If one is not passed
  82. an instance of `self.profile_class` is created. `self.profile` will be set to this
  83. value.
  84. *runner* should be an instance of a `mozrunner.Runner` subclass. If one is not passed an
  85. instance of :attr:`runner_class` will be created. :attr:`runner` will be set to this value.
  86. This method will also run `runner.start()` and :func:`mozrunner.wait_and_create_network`
  87. and sets :attr:`back_channel` and :attr:`bridge` to instances of
  88. :class:`jsbridge.BackChannel` and :class:`jsbridge.Bridge` respectively.
  89. .. attribute:: profile
  90. Set during :meth:`start` to subclass of :class:`mozrunner.Profile`.
  91. .. attribute:: runner
  92. Set during :meth:`start` to subclass of :class:`mozrunner.Runner`.
  93. .. attribute:: back_channel
  94. Set during :meth:`start` to subclass of :class:`jsbridge.BackChannel`.
  95. .. attribute:: bridge
  96. Set during :meth:`start` to subclass of :class:`jsbridge.Bridge`
  97. .. method:: run_tests(test[, report])
  98. Run *test* in live Firefox using :attr:`bridge`.
  99. Adds local listeners :meth:`endTest_listener` and :meth:`endRunner_listener` to
  100. `"endTest"` and `"endRunner"` events using :meth:`jsbridge.BackChannel.add_listener` of
  101. :attr:`back_channel`.
  102. When tests are done the results are posted to a results server at *report* if passed.
  103. .. method:: endTest_listener(test)
  104. When a test is finished the test object will be passed to this callback.
  105. .. method:: endRunner_listener(obj)
  106. When all the tests are done running this callback will be fired.