wptrunner Internals

class wptrunner.executors.base.CallbackHandler(logger, protocol, test_window)

Handle callbacks from testdriver-using tests.

The default implementation here makes sense for things that are roughly like WebDriver. Things that are more different to WebDriver may need to create a fully custom implementation.

class wptrunner.executors.base.CrashtestExecutor(logger, browser, server_config, timeout_multiplier=1, debug_info=None, **kwargs)
exception wptrunner.executors.base.ExecutorException(status, message)
class wptrunner.executors.base.PrintRefTestExecutor(logger, browser, server_config, timeout_multiplier=1, debug_info=None, **kwargs)
class wptrunner.executors.base.RefTestExecutor(logger, browser, server_config, timeout_multiplier=1, screenshot_cache=None, debug_info=None, reftest_screenshot='unexpected', **kwargs)
class wptrunner.executors.base.TestExecutor(logger, browser, server_config, timeout_multiplier=1, debug_info=None, **kwargs)

Abstract Base class for object that actually executes the tests in a specific browser. Typically there will be a different TestExecutor subclass for each test type and method of executing tests.

Parameters
  • browser – ExecutorBrowser instance providing properties of the browser that will be tested.

  • server_config – Dictionary of wptserve server configuration of the form stored in TestEnvironment.config

  • timeout_multiplier – Multiplier relative to base timeout to use when setting test timeout.

abstract do_test(test)

Test-type and protocol specific implementation of running a specific test.

Parameters

test – The test to run.

reset()

Re-initialize internal state to facilitate repeated test execution as implemented by the –rerun command-line argument.

run_test(test)

Run a particular test.

Parameters

test – The test to run

setup(runner)

Run steps needed before tests can be started e.g. connecting to browser instance

Parameters

runner – TestRunner instance that is going to run the tests

teardown()

Run cleanup steps after tests have finished

class wptrunner.executors.base.TestharnessExecutor(logger, browser, server_config, timeout_multiplier=1, debug_info=None, **kwargs)
class wptrunner.executors.base.WdspecExecutor(logger, browser, server_config, webdriver_binary, webdriver_args, timeout_multiplier=1, capabilities=None, debug_info=None, **kwargs)
do_test(test)

Test-type and protocol specific implementation of running a specific test.

Parameters

test – The test to run.

protocol_cls

alias of wptrunner.executors.protocol.WdspecProtocol

setup(runner)

Run steps needed before tests can be started e.g. connecting to browser instance

Parameters

runner – TestRunner instance that is going to run the tests

wptrunner.executors.base.get_pages(ranges_value, total_pages)

Get a set of page numbers to include in a print reftest.

Parameters
  • ranges_value – Parsed page ranges as a list e.g. [[1,2], [4], [6,None]]

  • total_pages – Integer total number of pages in the paginated output.

Retval

Set containing integer page numbers to include in the comparison e.g. for the example ranges value and 10 total pages this would be {1,2,4,6,7,8,9,10}

wptrunner.executors.base.hash_screenshots(screenshots)

Computes the sha1 checksum of a list of base64-encoded screenshots.

wptrunner.executors.base.strip_server(url)

Remove the scheme and netloc from a url, leaving only the path and any query or fragment.

url - the url to strip

e.g. http://example.org:8000/tests?id=1#2 becomes /tests?id=1#2