Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Mozilla WebQA plugin for py.test.
tag: 0.2

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


pytest_mozwebqa is a plugin for py.test that provides additional features needed for Mozilla's WebQA projects.


  • py.test
  • selenium
  • pyyaml


$ python install

Running tests with pytest_mozwebqa

For full usage details run the following command:

$ py.test --help

   --webqareport=path  create mozilla webqa custom report file at given path. default is 'results.html'

  --baseurl=url        base url for the application under test.
  --api=api            version of selenium api to use. 'rc' uses selenium rc.
                       'webdriver' uses selenium webdriver (the default).
  --host=str           host that selenium server is listening on.
  --port=num           port that selenium server is listening on.
  --driver=str         webdriver implementation.
  --chromepath=path    path to the google chrome driver executable.
  --firefoxpath=path   path to the target firefox binary.
  --browser=str        target browser (standalone rc server).
  --environment=str    target environment (grid rc).
  --browsername=str    target browser name (webdriver).
  --browserver=str     target browser version (webdriver).
  --platform=str       target platform (webdriver).
  --timeout=num        timeout for page loads, etc (selenium rc).
  --capturenetwork     capture network traffic to test_method_name.json
                       (selenium rc). (disabled by default).

  --credentials=path  location of yaml file containing user credentials.
  --saucelabs=path    credendials file containing sauce labs username and api key.


Run tests against a standalone RC server using Firefox in the default location:

$ py.test --baseurl= --api=rc --browser="*firefox"

Run tests against a grid server with an RC node environment named 'Firefox 5 on Mac OS X':

$ py.test --baseurl= --api=rc --environment="Firefox 5 on Mac OS X"

Run tests against a local webdriver using Firefox:

$ py.test --baseurl= --driver=firefox --firefoxpath=/Applications/

Run tests against a local webdriver using Google Chrome:

$ py.test --baseurl= --driver=chrome --chromepath=/Applications/chromedriver

Run tests against a remote webdriver server either directly or via grid:

$ py.test --baseurl= --browsername=firefox --browserver=5 --platform=mac

Run tests against Sauce Labs using RC API using Firefox 5 on Windows 2003:

$ py.test --baseurl= --api=rc --browsername=firefox --browserver=5.0 --platform="Windows 2003" --saucelabs=sauce_labs.yaml

Run tests against Sauce Labs using webdriver API using Firefox 5 on Windows:

$ py.test --baseurl= --browsername=firefox --browserver=5.0 --platform=WINDOWS --saucelabs=sauce_labs.yaml

Writing tests for pytest_mozwebqa

You will need to include the mozwebqa in the method signature for your tests, and pass it when constructing page objects.


def test_new_user_can_register(self, mozwebqa):
    home_pg = home_page.HomePage(mozwebqa)

    registration_pg = registration_page.RegistrationPage(mozwebqa)
    Assert.equal(registration_pg.page_title, "Sign Up Complete!")

Using credentials files

The credentials files use YAML syntax, and the usage will vary depending on the project. A typical file will contain at least one user with a unique identifier and login credentials:


# admin:
#   email:
#   username: admin
#   password: password

Custom report

By default a custom HTML report will be written to results.html. If you wish this to be located elsewhere, or have a different filename, you can specify the --webqareport command line option.

Something went wrong with that request. Please try again.