Tricentis Tosca 16.0 Released on Feb-2023 ----- UFT has been upgraded from UFT 15.0.1 to UFT One 15.0.2, Beginning at November 2020.

Monday, 8 April 2019

Recovery Scenarios

What is an Exception ?  How did we handle Exceptions in our Project
An exception is an unexpected or unwanted event or error   because of which application crashes leading to test failure.

We have used recovery scenarios to handle the exceptions. we have called functions within the recovery scenarios to handle these exceptions.

What are Recovery scenarios
While executing our scripts we  may get some UNEXPECTED/UNPREDICTABLE errors and window pop up errors. To “recover” the test (for continue running) from these unexpected errors we use Recovery Scenarios.

What Constitute Recovery Scenarios
Recovery scenario consists of the following types.
a. Trigger Event: The event that interrupts our run session. 
For example, a window that may pop up on screen or a UFT/QTP run error.

b. Recovery operations : The operations to perform to enable UFT to continue running the test after the trigger event interrupts the run session. 
For example, Clicking an OK button in a pop-up window or restarting Microsoft windows.
 
c. Post-Recovery Test Run Option: The instruction on how UFT/QTP should proceed after the recovery operations have been performed and from which point in the test UFT should continue, if at all. 
For example, we may want to restart a test from the beginig or skip a step entirely and continue with the next step in the test.

NOTERecovery scenarios are saved in recovery scenario files having the extension .qrs. A recovery scenario file is a logical collection of recovery scenarios, grouped according to our own specific requirements.

What is the process of creating a Recovery Scenarios 
The following are steps mentioned for creating recovery scenario.

  1. Defining the trigger event that interrupts the run session.
  2. Specifying the recovery operations  required to continue.
  3. Choosing a post-recovery test run operation.
  4. Specifying a name and description for the recovery scenario.
  5. Specifying whether to associate the recovery scenario to the current test and or to all new tests.

How Exactly does the Recovery Scenario Mechanism Works
When UFT/QTP gets an error, it will check for any associated recovery scenarios. If any recovery scenario is associated, then UFT will identify the Object/Condition specified in trigger event. If that Object/condition matches, then UFT executes the specified Recovery Operation. Specified Post Recovery Operation will also be executed after the Recovery Operation.

What are the Different reasons which will generate errors in your project 
If we get an error, that is because of 3 reasons..

1.Scripts Issue: A poor script development will give poor result. Because of this we get Test Run Errors.

2.Application Issue:  Application generates unwanted  pop ups or through's unexpected events in script run-time.

3.Environment Issue: Application suddenly crashes because of environment issue.

How do we handle the exceptions generated by application 
We have two types of Exceptions that will be generated by Application.

a. Unwanted popup windows: The unwanted/unexpected Popup windows will disrupt the Script and cause the failure. To handle them we have used Popup Recovery Scenario. In this, we have specified the window name and how to handle it by using a recovery operation.

b. Object Related Errors:  Sometimes we get errors like "Page cannot be displayed"  or an application is opened, due to an internal problem, the window is not responding and all of the objects are in disable state.  In this case, we can use Object State Recovery Scenario which will execute a Recovery Operation based on Object State that is already provided by me when creating it.

How do we handle the exceptions generated by UFT/QTP 
UFT generates exceptions and those are called as Test Run Errors. We can handle Only object and Object Data Related Test Run Errors. The errors are  

1.Object is disabled
2.Object not found
3.Object not visible
4.Item in Menu or List not unique
5.More than one Object Respond to its physical description
6.Item in Menu or List not found.

How do we handle the exception raised because of environment
An environment issue causes the Application Crash or No Response from the Application. For application Crashes we use the Application Crash Recovery Scenario. We can define a recovery scenario to set the application normal. For no Response we can use Object state Recovery scenario to perform a recovery operation.

What is trigger event 
Trigger event is an event that interrupts our run session which will cause Test Failure. This can happen in both UFT and Application. 

What is Recovery operation
The operation which recovers UFT to run the test after a trigger event interrupts the run session. 
  
What are the types in Recovery Operation 
1.Function Call: We can specify a function to be executed when performing the recovery operation.

2.Keyword or Mouse Operation:  In this there are multiple sub operations 
  1. Click Default button/ Press  the ENTER Key.
  2. Click Cancel button/ Press the ESCAPE key.
  3. Click button with label.
  4. Press key or Key combination
By using Click button with label, we can specify a button which is there in the application. By using Press Key or Key combination, we can specify a key to be pressed or with a combination ctrl/alt to be pressed in the recovery operation.

3. Close  Application Process:  We can specify a process to be closed when we get an error. It display current running list of processes in our machine. We can choose any of the process to closed when that Recovery Scenario is executed. 

Where do we write Recovery Functions 
We can write Recovery Functions in Libraries and specify those libraries when creating the recovery scenario. We can create libraries from UFT using Create new function library option. We can also use .vbs or .txt files as libraries.

How many recovery scenarios have been developed in your project 
We have developed over 10 recovery scenarios for below purposes : 
  1. To handle a message that is displayed when an ActiveX object on an Internet Explorer page may be unsafe.
  2. To handle Internet Explorer ASP errors.
  3. To handle a message that is displayed when a file is selected for download.
  4. To handle a message that is displayed when Internet Explorer is about to redirect to a new Internet site.
  5. To handle a message that is  displayed when an object cannot be fount in internet Explorer. 
  6. To handle security Alerts.
  7. To handle Application Generated Object Related Exceptions.
  8. To handle UFT/QTP Generated Exceptions.
  9. To handle Application Crashes
What are the Recovery Scenarios used in Your Project
We have used all of the recovery scenarios Popup, ObjectState, TestRunErrors and Application crash.

What is the extension for recovery scenario file
QRS---- Quicktest Recovery Scenario.

Loading Recovery scenarios at run time or dynamically 
Set qtApp = CreateObject("QuickTest.Application")
Set qtTestRecovery = qtApp.Test.Settings.Recovery
    
qtTestRecovery.Add"C:\TEST\Project\RecoveryScenario\Testfailurenote.qrs""TestFailing" , 1
qtTestRecovery.Add"C:\TEST\Project\RecoveryScenario\TestfailureNote.qrs""TestNote" , 2

For intIndex = 1 To qtTestRecovery.Count
      qtTestRecovery.Item(intIndex).Enabled = True
Next
qtTestRecovery.Enabled = true

qtTestRecovery.SetActivationMode "OnError"
Set qtApp = Nothing 

No comments:

Post a Comment

Note: only a member of this blog may post a comment.