Package funkload :: Module FunkLoadTestCase :: Class FunkLoadTestCase
[hide private]
[frames] | no frames]

Class FunkLoadTestCase

source code

       object --+    
                |    
unittest.TestCase --+
                    |
                   FunkLoadTestCase
Known Subclasses:

Unit test with browser and configuration capabilties.

Nested Classes [hide private]

Inherited from unittest.TestCase: failureException

Instance Methods [hide private]
 
__call__(self, result=None)
Run the test method.
source code
 
__init__(self, methodName='runTest', options=None)
Initialise the test case.
source code
 
_browse(self, url_in, params_in=None, description=None, ok_codes=None, method='post', follow_redirect=True, load_auto_links=True, sleep=True)
Simulate a browser handle redirects, load/cache css and images.
source code
 
_close_result_log(self)
Close the result log.
source code
 
_connect(self, url, params, ok_codes, rtype, description)
Handle fetching, logging, errors and history.
source code
 
_dump_content(self, response)
Dump the html content in a file.
source code
 
_funkload_init(self)
Initialize a funkload test case using a configuration file.
source code
 
_log_response(self, response, rtype, description, time_start, time_stop, log_body=False)
Log a response.
source code
 
_log_response_error(self, url, rtype, description, time_start, time_stop)
Log a response that raise an unexpected exception.
source code
 
_log_result(self, time_start, time_stop)
Log the test result.
source code
 
_log_xmlrpc_response(self, url, method, description, response, time_start, time_stop, code)
Log a response.
source code
 
_logr(self, message, force=False)
Log a result.
source code
 
_open_result_log(self, **kw)
Open the result log.
source code
 
addHeader(self, key, value)
Add an http header.
source code
 
clearBasicAuth(self)
Remove basic authentication.
source code
 
clearContext(self)
Reset the testcase.
source code
 
clearHeaders(self)
Remove all http headers set by addHeader or setUserAgent.
source code
 
clearKeyAndCertificateFile(self)
Clear any key file or certificate file paths set by calls to setKeyAndCertificateFile.
source code
 
conf_get(self, section, key, default=[], quiet=False)
Return an entry from the options or configuration file.
source code
 
conf_getFloat(self, section, key, default=[], quiet=False)
Return a float from the configuration file.
source code
 
conf_getInt(self, section, key, default=[], quiet=False)
Return an integer from the configuration file.
source code
 
conf_getList(self, section, key, default=[], quiet=False, separator=None)
Return a list from the configuration file.
source code
 
debugHeaders(self, debug_headers=True)
Print request headers.
source code
 
delHeader(self, key)
Remove an http header key.
source code
 
exists(self, url, params=None, description='Checking existence')
Try a GET on URL return True if the page exists or False.
source code
 
get(self, url, params=None, description=None, ok_codes=None)
GET method on url adding params.
source code
 
getBody(self)
Return the last response content.
source code
 
getLastBaseUrl(self)
Return the base href url.
source code
 
getLastUrl(self)
Return the last accessed url taking into account redirection.
source code
 
listHref(self, url_pattern=None, content_pattern=None)
Return a list of href anchor url present in the last html response.
source code
 
logd(self, message)
Debug log.
source code
 
logdd(self, message)
Verbose Debug log.
source code
 
logi(self, message)
Info log.
source code
 
post(self, url, params=None, description=None, ok_codes=None)
POST method on url with params.
source code
 
setBasicAuth(self, login, password)
Set http basic authentication.
source code
 
setHeader(self, key, value)
Add or override an http header.
source code
 
setKeyAndCertificateFile(self, keyfile_path, certfile_path)
Set the paths to a key file and a certificate file that will be used by a https (ssl/tls) connection when calling the post or get methods.
source code
 
setUpCycle(self)
Called on bench mode before a cycle start.
source code
 
setUserAgent(self, agent)
Set User-Agent http header for the next requests.
source code
 
sleep(self)
Sleeps a random amount of time.
source code
 
tearDownCycle(self)
Called after a cycle in bench mode.
source code
 
waitUntilAvailable(self, url, time_out=20, sleep_time=2)
Wait until url is available.
source code
 
xmlrpc(self, url_in, method_name, params=None, description=None)
Call an xml rpc method_name on url with params.
source code
 
xmlrpc_call(self, url_in, method_name, params=None, description=None)
BBB of xmlrpc, this method will be removed for 1.6.0.
source code

Inherited from unittest.TestCase: __repr__, __str__, assertAlmostEqual, assertAlmostEquals, assertEqual, assertEquals, assertFalse, assertNotAlmostEqual, assertNotAlmostEquals, assertNotEqual, assertNotEquals, assertRaises, assertTrue, assert_, countTestCases, debug, defaultTestResult, fail, failIf, failIfAlmostEqual, failIfEqual, failUnless, failUnlessAlmostEqual, failUnlessEqual, failUnlessRaises, id, run, setUp, shortDescription, tearDown

Inherited from unittest.TestCase (private): _exc_info

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__call__(self, result=None)
(Call operator)

source code 

Run the test method.

Override to log test result.

Overrides: unittest.TestCase.__call__

__init__(self, methodName='runTest', options=None)
(Constructor)

source code 

Initialise the test case.

Note that methodName is encoded in bench mode to provide additional information like thread_id, concurrent virtual users...

Overrides: object.__init__

_dump_content(self, response)

source code 

Dump the html content in a file.

Use firefox to render the content if we are in rt viewing mode.

clearHeaders(self)

source code 

Remove all http headers set by addHeader or setUserAgent.

Note that the Referer is also removed.

listHref(self, url_pattern=None, content_pattern=None)

source code 

Return a list of href anchor url present in the last html response.

Filtering href with url pattern or link text pattern.

setHeader(self, key, value)

source code 

Add or override an http header.

If value is None, the key is removed.

setKeyAndCertificateFile(self, keyfile_path, certfile_path)

source code 

Set the paths to a key file and a certificate file that will be used by a https (ssl/tls) connection when calling the post or get methods.

keyfile_path : path to a PEM formatted file that contains your private key. certfile_path : path to a PEM formatted certificate chain file.

setUserAgent(self, agent)

source code 

Set User-Agent http header for the next requests.

If agent is None, the user agent header is removed.

sleep(self)

source code 

Sleeps a random amount of time.

Between the predefined sleep_time_min and sleep_time_max values.

waitUntilAvailable(self, url, time_out=20, sleep_time=2)

source code 

Wait until url is available.

Try a get on url every sleep_time until server is reached or time is out.