Firefox Greenlight Tests
(aka Marionette training)
Chris Manchester - chmanchester
Andrew Halberstadt - ahal
Slides - https://slides.com/ahal/greenlight
Why Re-write Mozmill Tests?
- Marionette works with electrolysis
- Marionette is based on web standards
- Marionette test runner is used across many test harnesses
What is Marionette?
A tool to remotely control Firefox Desktop and Firefox OS
Make Gecko dance!
Marionette Server
Gecko
Marionette Client
Marionette is two parts
session
A Basic Test
from greenlight.harness.testcase import FirefoxTestCase
class TestTabs(FirefoxTestCase):
def setUp(self):
FirefoxTestCase.setUp(self)
# perform per test setup here
def tearDown(self):
# perform per test teardown here
FirefoxTestCase.tearDown(self)
def test_open_a_tab(self):
num_tabs = len(self.tabstrip.tabs)
self.tabstrip.newtab_button.click()
self.assertEquals(len(self.tabstrip.tabs), num_tabs + 1)
def test_another_thing(self):
# do something
Marionette Server
Gecko
Marionette Client
Firefox Puppeteer
Marionette is Gecko specific, not Firefox specific
Firefox Greenlight Tests
Getting Ready
Requirements:
Python 2.7
https://www.python.org/downloads/
Git
http://www.git-scm.com/downloads
A nightly Firefox Build
Setup Python
- Install pip - https://pip.pypa.io/en/latest/installing.html
$ wget "https://bootstrap.pypa.io/get-pip.py"
$ sudo python get-pip.py
- Install virtualenv and virtualenvwrapper
$ sudo pip install virtualenv
$ sudo pip install virtualenvwrapper
$ source `which virtualenvwrapper.sh`
Firefox Greenlight Tests
- Clone the repo
$ git clone https://github.com/mozilla/firefox-greenlight-tests.git
$ cd firefox-greenlight-tests
- Install the package and dependencies
# if using virtualenvwrapper
$ mkvirtualenv greenlight
$ python setup.py develop
# if using plain virtualenv
$ virtualenv greenlight
$ source greenlight/bin/activate
$ python setup.py develop
Test Marionette
- Run nightly with marionette enabled
$ /path/to/nightly/firefox -marionette
- Start an interactive Python shell
$ python
- Attempt to connect to Marionette server
> from marionette import Marionette
> client = Marionette('localhost', 2828)
> client.start_session()
Run the Tests
$ greenlight --binary /path/to/nightly/firefox
- Run all tests in the suite
- Run a specific test or manifest
$ greenlight --binary /path/to/nightly/firefox path/to/test/or/manifest/file
Marionette MDN page
https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette
Marionette-client documentation
http://marionette-client.readthedocs.org/en/latest/
Firefox Puppeteer documentation
http://firefox-puppeteer.readthedocs.org/en/latest/
Firefox Greenlight Tests repository
Let's Write a Test
Greenlight
By ahal
Greenlight
- 1,424