Working with Recovery Scenarios in Your Test Script - WinRunner

You can use TSL statements to activate or deactivate a specific recovery scenario, or to deactivate all active recovery scenarios during a test run. You can also define simple recovery scenarios using TSL.

Activating and Deactivating Recovery Scenarios During the Test Run

The Recovery Manager enables you to activate or deactivate recovery scenarios while designing your test, but you may need to turn a recovery scenario on or off during a test run.

Suppose you define a recovery scenario that runs a recovery function. If the exception event triggers the recovery scenario, and then the exception event occurs again while the recovery function for that event is running, the recovery scenario may get stuck in an infinite loop. Thus it is recommended to deactivate the recovery scenario at the beginning of that recovery scenario’s recovery function, and to reactivate it at the end of the function. To activate and deactivate a specific recovery scenario use the exception_on and exception_off functions.

For example: The following recovery function turns off the handling of its recovery scenario before executing the main recovery script (which reopens the application being tested). Then it turns the recovery scenario on again. public function label_handler(in win, in obj, in attr, in val)

#ignore this recovery scenario while performing the recovery function:
report_msg("Label has changed");
menu_select_item ("File;Exit");
system ("flights&");
invoke_application ("flights", "", "C:\FRS", "SW_SHOWMAXIMIZED");
#if the value of "attr" no longer equals "val":

You can also deactivate all recovery scenarios during a test run. For example, you may want to prevent WinRunner from performing recovery scenarios if a certain conditional statement is true.To deactivate all active recovery scenarios, use the exception_off_all function.

Defining Simple Recovery Scenarios Using TSL

You can use the define_object_exception, define_popup_exception, and define_TSL_exception functions to define new simple recovery scenarios from your test script that are active only for the current WinRunner session. This can be useful if you want to use a returned value as input for your recovery scenario.

When you define a simple recovery scenario using one of the above functions, the simple recovery scenario is displayed in the Recovery Manager during the WinRunner session and you can modify the recovery scenario using the recovery wizard, but these recovery scenarios are not saved in the recovery scenarios file and are not available from the Recovery Manager when WinRunner restarts.

To create compound recovery scenarios, which enable you to define crash events and/or multiple recovery operations, use the Recovery Manager.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

WinRunner Topics