1,072
edits
No edit summary |
No edit summary |
||
Line 116: | Line 116: | ||
* The POM test cases don’t have a verbose mode convention. If desired, a print statement with the breadcrumbs variable could be added to a test case. | * The POM test cases don’t have a verbose mode convention. If desired, a print statement with the breadcrumbs variable could be added to a test case. | ||
'''Implementation''' | |||
'''Pre-POM test cases''' use string variables named tc_breadcrumbs* and build breadcrumbs them by concatenating a new value to a “parent”. (The tc_* variable name prefix distinguishes it from the breadcrumb element that often appears in the page header.)<br> | |||
The following example sets the breadcrumbs which contains the current options (user, application, etc) and the current add-on being processed in a list. The next statement optionally prints the breadcrumbs to the console based on the verbosity level.<br> | |||
for addon_index in range(1, max_addons + 1): | |||
f = '%s, add-on #%s' | |||
tc_breadcrumbs_addon = f % (tc_breadcrumbs_options, addon_index) | |||
if CONSOLE_TRACE >= 2: print tc_breadcrumbs_addon | |||
<br> | |||
The '''POM test cases''' use TestCastBreadcrumbs object that's defined in the testcase_breadcrumbs module which stores a list of (type, value) pairs, treating them like a LIFO stack. The breadcrumbs are primarily updated by an add(type, value) method. A __str__ method formats the list into a string. <br> | |||
The SavedExceptions data type contains a breadcrumbs attribute. POM test cases typically use breadcrumbs attribute that's inside a SavedExceptions object, typically named ''ex''.<br> | |||
for addon_index in range(1, max_addons + 1): | |||
ex.breadcrumbs.add('add-on', '#%d' % addon_index) | |||
if CONSOLE_TRACE >= 2: print ex.breadcrumbs | |||
Although the example has a conditional print, most POM test cases haven't implemented a verbosity. | |||
== Saved Exceptions == | == Saved Exceptions == |
edits