Package tlib :: Package base :: Module WptHelper :: Class WptHelper
[hide private]
[frames] | no frames]

Class WptHelper

source code

object --+
         |
        WptHelper

Helper class to send jobs to WebPagetest and get job results

Instance Methods [hide private]
 
__init__(self, logger, wpt_server, wpt_params)
Constructor for class
source code
dict
test_urls_and_wait(self, requested_urls)
Submits a test request for a list of URLs and waits until results are returned
source code
dict
test_script_and_wait(self, script)
Submits a test request with a script and waits until results are returned
source code
dict
test_url_and_wait(self, url)
Submits a test request for a URL and waits until results are returned
source code
dict
_get_test_results(self, xml_text)
Extracts global test metrics from DOM object returned by WPT and returns them as a dictionary
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  _wpt_server = None
  _wpt_params = {}
  _logger = None
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, logger, wpt_server, wpt_params)
(Constructor)

source code 

Constructor for class

Parameters:
  • logger (logging.Logger) - instance of a logging object configured in testing project
  • wpt_server (str) - URL of the WebPagetest server used for testing, e.g. http://172.27.108.148:8080
  • wpt_params (dict) - Dictionarry with test settings. See https://sites.google.com/a/webpagetest.org/docs/advanced-features/webpagetest-restful-apis for more details
Overrides: object.__init__

test_urls_and_wait(self, requested_urls)

source code 

Submits a test request for a list of URLs and waits until results are returned

Parameters:
  • requested_urls (list) - List of URLs to test
Returns: dict
Results as generated by WebPagetest For each item in the response, URL is the key and a dom object is the value

test_script_and_wait(self, script)

source code 

Submits a test request with a script and waits until results are returned

Parameters:
  • script (str) - script
Returns: dict
Results as generated by WebPagetest For each item in the response, URL is the key and a dom object is the value

test_url_and_wait(self, url)

source code 

Submits a test request for a URL and waits until results are returned

Parameters:
  • url (str) - URLs to test
Returns: dict
Results as generated by WebPagetest For each item in the response, URL is the key and a dom object is the value

_get_test_results(self, xml_text)

source code 

Extracts global test metrics from DOM object returned by WPT and returns them as a dictionary

Parameters:
  • xml_text (str) - XML returned by WPT server
Returns: dict
Returns a dictionary with the metrics extracted from XML