1)
Make sure Flight Reservation window is open.
Fill Date of Flight, Fly From and Fly To fields.
Click Record in QTP in order to start recording.
Click on the Flights button in the Flight Reservation window.
When the Flights Table window opens click on OK.
Click stop in order to stop recording.
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
2)
Go to File->New->Function Library
A new Function Library will be open. Without writing anything in the Function Library (let it be empty), just Save it and close it.
We will create Recovery Function in accordance with the prototype syntax of the Pop-up window at the time of creating a Recovery Scenario.
3)
Go to Resources->Recovery Scenario Manager...
Recovery Scenario Manager window opens
Click on "New Scenario" icon to open Recovery Scenario Wizard.
Click Next.
From Select Trigger Event, choose Test run error. Click Next.
In "Select Test Run Error" area, choose "Object is disabled" from Error dropdown. Click Next.
Recovery Operations area opens, Click Next.
Choose Recovery Operation as Function Call, click next.
On the next screen, click on button on the right of "Function Library" dropdown to select the function library we created earlier.
Click "Define new function:" radio button and The function in the Function prototype will be:
Function RecoveryFunction1(Object)
msgbox "hello Function"
End Function
Click Next
In the Recovery Operation window uncheck "Add another recovery operation". Click Next.
In the Post-Recovery Test Run Options choose "Stop the test run" radio button. Click Next.
Give the Recovery Scenario a Name and Description and click Next
In Completing the Recovery Scenario Wizard area check "Add scenario to current test" and click Finish.
In the Recovery Scenario Manager window you will see one scenario added in the scenarios area.
Click Close and save the Recovery Scenario.
Now when you Run the test make sure in the Flight Reservation window you go to File->New Order, so as to empty all fields and disable Flights button to see if the Recovery Scenario is triggered when the object is disabled.