Test Design StudioGo to Previous Topic: CA0120 - Close error handlers in routinesGo to Next Topic: Documentation Rules

CA0122 - Restore recovery when disabled in routines

Summary

It is often necessary to use the 'Recovery.Enabled = False' statement to prevent Unified Functional Testing from activating recovery scenarios during controlled situations. When used within a procedure, it is important to enable recovery before exiting the procedure or else other code may not utilize the recovery scenarios as intended.

Note:    This rule can only check for the presence of the 'Recovery.Enabled = True' statement, but cannot analyze the execution flow of your routine to make sure it is called before every possible exit path. If you have multiple exit paths (via 'Exit Function', 'Exit Sub', or 'Exit Property'), make sure that 'Recovery.Enabled = True' is called before each exit as well as at the end of the routine.
Note:    This rule can only test when 'Recovery.Enabled' is assigned a value of 'True' or 'False'. If you use a boolean-based variable to alter the enabled property instead of explicitly setting 'True' or 'False', the code analysis will not be able to determine the state of the 'Recovery.Enabled' property and this rule may process correctly.

Solution

Add the statement 'Recovery.Enabled = True' before every exit path of the routine.