QA/Execution/Web Testing/Docs/Automation/Testcases/ConventionsAmoTests: Difference between revisions

no edit summary
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 ===
'''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_ prefix distinguishes it from the breadcrumb element that often appears in the page header.)
'''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>


* In POM a TestCastBreadcrumbs object is defined in the testcase_breadcrumbs module. which stores them as a list of  (type, value) pairs and 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.  The SavedExceptions data type contains a breadcrumbs attribute.  Existing POM test cases use a SavedException object, typically named ‘ex’, to maintain breadcrumbs.
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&nbsp;% (tc_breadcrumbs_options, addon_index)
    if CONSOLE_TRACE &gt;= 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.&nbsp; 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'&nbsp;% addon_index)
    if CONSOLE_TRACE &gt;= 2: print ex.breadcrumbs
Although the example has a conditional print, most POM test cases haven't implemented a verbosity.


== Saved Exceptions ==
== Saved Exceptions ==
1,072

edits