--
MikealRogers - 19 Jul 2006
Broadsword -- TestObject Documentation
Where is TestObject
TestObject lives in the tools repository under the broadsword project.
svn co svn+ssh://svn.osafoundation.org/svn/tools/broadsword/trunk/modules/TestObject.py TestObject.py
What is TestObject
TestObject is the base class for all broadsword test tools.
TestObject provides all the test framework needs to other test tools.
What is defined in TestObject
Initialization
TestObject, a lightweight testing "micro-framework"
TestObject is used for writing test tools. It contains masking, debugging, extensible printed logging, support for threaded stress test env, and some simple comparison methods.
Keyword Arguments:
debug: int -- Debug value, > 1 shows passed tests
headers: dict -- Initial headers dictionary, if a certain test server requires a specific
header you can save the trouble of adding the header by hand in each test
class. Also useful in emulate new clients without changing test classes.
mask: int -- Used for masking output, useful during large test suites.
recurrence: int -- Amount of times you wish to run self.recurringTest method in test classes
appendDict: dict -- Used by test class writers when executing tests and writing self.startTest methods.
Currently not needed unless you run test classes in threaded stress testing env.
appendList: list -- List used for appends by test class writers.
appendVar: str -- String used for conveinient test class appends.
printAppend: str -- Used by printOut() method for appending to print. Useful when appending
thread number in stress testing framework.
threadNum: int -- Used by threaded stress testing system to keep track of thread number.
Member Assignments:
self.debug: int -- Noted above.
self.mask: int -- Noted above.
self.results: list -- Results list, set to empty list.
self.resultNames: list -- List of strings for each test.
self.resultComments: list -- List of strings for each test comment.
self.recurrence: int -- Noted above.
self.appendVar: str -- Noted above.
self.printAppend: str -- Noted above
self.threadNum: int -- Noted above.
self.appendDict: dict -- Noted above.
self.appendList: list -- Noted above.
printOut method
Method to handle printing while observing masking.
testStart method
Method to set and print current test name.
report method
Method to report PASS/FAIL.
Handles debug feature, will only print PASS if debug > 0.
listComparison method
Method to verify if lists of strings are within a comparison string and report PASS/FAIL.
runRecurring method
Method to execute self.recurringRun() for amount of times set in self.recurrence.
fullRun method
Method to execute all test functions in order: startRun(), runRecurring(), end().
end method
Method to calculate pass fails at the end of test suite.
Does not handle threaded stress testing, result calculation must be done by hand in stress env.