Recovery Scenario

QTP is having a special feature called as “Recovery Scenario” for handling unexpected behaviors (e.g appearance of pop-up windows) of the application during the test execution.

We need to do two steps for using recovery Scenario. One is creating recovery Scenario file (.qrs file) and another step is associating the recovery scenario to the Tests.

We can use recovery scenario manager/wizard for creating recovery scenario file.

The Recovery Scenario Wizard allows you to create recovery scenario file by step-by-step process.

 The Recovery Scenario Wizard contains five main steps

 Ø      Defining the trigger event (Pop-up window, Object state, Test run error, Application crash) that interrupts the run session

Ø      Specifying the recovery operation(s) required to continue. We must define at least one recovery operation. And, we can add more than one recovery operations also.

Ø      Choosing a post-recovery test run operation from the list of various options such as Repeat current step and continue, Proceed to next step, Proceed to next action or component iteration, Proceed to next test iteration, Restart current test run, Stop the test run

Ø      Specifying a name and description for the recovery scenario.

Ø      specifying whether to associate the recovery scenario to the current test and/or to all new tests

 You open the Recovery Scenario Wizard by clicking the New Scenario button in the Recovery Scenario Manager Dialog box (Resources > Recovery Scenario Manager).

 And, we can associate one or more scenarios with a test in order to instruct QTP to execute the recovery scenario(s) during the run session if a trigger event occurs.

 We can add/Enable the required recovery scenario from the Recovery Tab of “Test Settings” window.

 Any one of below options can be selected for activating the Recovery Scenario.

  • On every step—The recovery mechanism is activated after every step.
  • On error—The recovery mechanism is activated only after steps that return an error return value.
  • Never

How to Learn QTP?

This chapter will give overview about learning QTP. You can read the details in coming chapters.

  • Begin with understanding the importance of software testing. You should learn software testing Concepts and you have to get clear understanding of functional and regression testing. You need to be bit familiar with Manual testing activities such as writing test cases, executing test cases and reporting the issues.
  • You have to understand the need and importance of software test automation before start learning QTP. Even having some basic knowledge about other Test automation tools such as Test Complete, Test Partner, SilkTest and Rational Robot will help to prepare Tool evaluation/selection document if you are going to use QTP as Test Automation Tool in your project.
  • Download some good QTP handbook from internet. And also, you can refer the Tutorial and other Help files installed with QTP installation.
  • Try to understand basics of Object repository. You will become more familiar with using Object Repository once after start working on QTP automation.
  • Familiarize yourself using QTP add-ins (i-e selecting/deselecting specific add-ins). Desired Add-ins can be selected while launching the QTP. Note that the add-ins enabled during recording should be enabled while running the script.
  • Understand the basic units such as Test, Actions and external vbscript in QTP by going thro’ the Help file and the Handbook document. Practice yourself by creating simple Test with one or two Actions.
  • Practice yourself by recording and playing some steps using the sample application (Flight booking Application).
  • Try to understand the need for having multiple Actions in a particular Test.
  • Practice yourself creating Actions and splitting the Actions. And also, understand the need for having external reusable actions, and practice yourself using “Call to Copy of Action” and “Call to Existing Action”.
  • Familiarize yourself with components such as Expert view, keyword view, Active Screen and Datatable.
  • Learn basics of vbscript by going thro’ the vbscript documentation available in QTP help file, and be familiar with syntax of frequently used vbscript functions such as mid, instr and split.
  • Do some practice to have clear understanding of relation between Test Objects stored in object repository and the Vbscript statements showing in the expert view. You can do it by changing name of Test Object in OR and see the name automatically got changed in the expert view statement. And also, you can try to add/remove/edit some properties of Test Object in the Object Repository.
  • Understand the relationship between the Keyword view and the expert view. Both views are having their own advantages. So try to use both views. For example, Keyword view will be useful for doing parameterization easily and expert view can be useful or rearranging the steps.
  • Learn different types of Checkpoints and use them in sample script developed using the sample application. Intentionally put wrong expected result in the checkpoints to see how the Test result will look when showing checkpoint failures.
  • Learn to use multiple Object repositories (both Local and Shared), and also practice to get clear understanding of merging of Object Repositories.
  • Learn Recovery Scenario to handle unexpected behavior of application.  For learning Recovery Scenario you may need some application which shows a pop-up window rarely/randomly. Mostly you can use a website which is having both https and http links. Security alert will be shown while moving from https pages to http pages.  You can use Recovery Scenario to handle this security alert window.
  • Read the Help file to get clear understanding of Datatable and parameterization. And also learn about Action iteration and Test iteration without any ambiguity. Practice it by creating Data Driven testing for simple login screen.
  • Start using Reporter.ReportEvent in the code to enhance the reporting of the results.
  • Use ObjectSpy to get familiar with finding both TO  properties and RO properties of the Object in the Application.
  • Learn to change Test Settings and the editor settings. Here you should have clear understanding of which setting is applicable for the particular Test and which setting is applicable for particular instance of QTP installation.
  • Understand the need for Synchronization and try to use different ways (use of sync(), waitproperty, and exist) to achieve it.
  • Practice to use Step Generator, Function Generator and Active Screen to speed up the automation script creation process. Effective use of Active Screen will help you to continue your QTP script development even when your application is not available.
  • Learn about different types of recording modes and understand the need for them. Low level recording may help you to handle some steps if the standard recording is not able to recognize the object using the currently available add-ins.
  • Learn how to create/use COM objects such instance of Internet Explorer browser and an instance of excel object. It will be very useful
  • Learn to use Debug feature effectively. For example, use of “Run from step” will significantly reduce the Debug time.
  • Understand the need for Regular expression and learn some frequently used regular expressions (e.g .*)
  • Learn about QTP automation framework creation, and try to create a framework best suitable for your needs.
  • Learn Automation Object Model and understand the need for them. For example Automation Object Model can be used for automatically start running QTP script at specified time.
  • Learn about best practices (e.g always using reference path) and coding standards.
  • Go thro’ the QTP forums (e.g www.sqaforums.com) and read the discussions to get familiar with QTP issues and solutions/workarounds.
  • Learn to connect with database table for checking the database content. For doing this either you can use Database Checkpoints or you can create script using createobject.
  • Learn basics of Descriptive programming (DP) which is the alternative for Object Repository (OR). Personally I won’t recommend to use DP because it will create maintenance problem. But anyway we need to learn Descriptive programming in case we need to update any existing DP code.
  • Learn to integrate with Quality Center (QC) which is Test Management Tool provided by HP. It was formerly known as “Test Director”. We can execute the scripts from QC itself. And, it is used  for maintaining Test cases and tracking Bug/Issues. Appropriate integration of QTP and QC will make Script maintenance, Execution and Reporting easy.