1,072
edits
No edit summary |
|||
Line 147: | Line 147: | ||
Although the example has a conditional print, most POM test cases haven't implemented a verbosity. | Although the example has a conditional print, most POM test cases haven't implemented a verbosity. | ||
== Saved Exceptions == | == Saved Exceptions == | ||
Test cases might capture certain errors and report them as a group at the end of the test. This is done where the same verifications are applied to multiple add-ons or pages, and it’s desirable to not end the test because of a minor discrepancy. (also see Troubleshooting AMO Test Runs wiki page.) | |||
Each saved exception contains three parts that are appended together on one message: | |||
#error summary. ex: “Updated date not found”, “Exception in reviews count link” | |||
#error details including values that failed the verification. An error captured in a try-except block might use the string returned by the exception class. ex: “text ‘reviews’ does not match regex ‘[0-9]+ reviews’ ”, “rating on browse page is ‘5 stars’, on detail page is ‘4 stars’ “. | |||
#test case breadcrumbs to help reconstruct the context the error happened on. ex: “User type: anonymous, App: firefox, Sort: popular, Add-on: #2 ‘Firefox sync’ | |||
'''Implementation''' | |||
'''Pre-POM test cases''' | |||
*Exception messages saved in a list | |||
*Error summary counts saved in a dictionary | |||
*saveException( ) function is defined locally in each test case, taking the error summary, error detail and TC breadcrumbs as parameters. | |||
*saved exceptions detail and summary counts are printed by teardown( ) using a for-loop | |||
'''POM test cases''' | |||
*The SavedExceptions class is defined in the saved_exceptions module. The object contains the exception list, error summary counts, and breadcrumbs. It also has a has_exceptions attribute which is True when any exceptions have been saved. | |||
*The class method save_exception(error_summary, error_detail) updates the exception detail list and error summary count. The internal breadcrumb attribute of the object is added to the detailed exception message. | |||
*The class method print_exceptions_to_stderr( ) prints the error summary counts and exception details, and raise an exception. Test cases call it from teardown( ). | |||
== Skipping Exceptions ( aka exception to the exception ) == | == Skipping Exceptions ( aka exception to the exception ) == |
edits