Thursday, February 21, 2013

About Recovery Scenario

Recovery Scenario

Recovery Scenario is a automated trouble shooter for any unwanted event during the test case /suite execution

The Recovery Scenario Wizard leads you, step-by-step, through the process of creating a recovery scenario.

When to choose recovery scenarios in qtp?


Recovery Scenario need to be added, whenever you see the possibility of unwanted or unexpected events happening during the test suite/ case execution. The list of unwanted events can be any one of them as mentioned below
1) Pop-up window
2) Object state
3) Test run error
4) Application crash

Steps to be followed add a recovery scenario in qtp

The steps to be followed to add a recovery scenario is as follows:

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

What is the trigger event can be chosen for a recovery scenario in qtp

The Select Trigger Event screen enables you to define the event type that triggers the recovery scenario. Basically there are four types of trigger events. They are:

QuickTest detects the Trigger Event based on one of the Trigger

1) Pop-up window. A pop-up window and identifies it according to the window title and textual content.
2) Object state. A specific test object state and identifies it according to its property values and the property values of all its ancestors.
3) Test run error. A run error and identifies it by a failed return value from a method.
4) Application crash. An application crash and identifies it according to a predefined list of applications

What are the types of recovery operations can be chosen in qtp

The Recovery Operation screen enables you to specify the operations QuickTest performs after it detects the trigger event.
There are 4 types of recovery operations available in QTP.

1) Keyboard or mouse operation. QuickTest simulates a click on a button in a window or a press of a keyboard key.
2) Close application process. QuickTest closes specified processes.
3) Function call. QuickTest calls a VBScript function.
4) Restart Microsoft Windows. QuickTest restarts Microsoft Windows

What are the post recovery operations available for a pop up window trigger event in qtp

Post-recovery test run options specify how to continue the run session after QTP has identified the event and performed all of the specified recovery operations

There are 6 types of Post-recovery operations are available. They are:

1) Repeat current step and continue The current step is repeated, the step that QTP was running when the recovery scenario was triggered.
2) Proceed to next step Skips the step that QTP was running when the recovery scenario was triggered.
3) Proceed to next action or component iteration Stops performing steps in the current action or component iteration and begins the next iteration from the beginning
4) Proceed to next test iteration Stops performing steps in the current action or component and begins the next QuickTest test or business process test iteration from the beginning
5) Restart current test run Stops performing steps and re-runs the test or component from the beginning.
6) Stop the test run Stops running the test or component.

How can you view the recovery scenario properties in non-editable mode in qtp
Assume that one of the recovery scenario is already associated with the current test case. The recovery scenario properties in non-editable mode can be seen by following the below mentioned steps.


1) Choose File -> Settings
2) Test Settings Dialog Box will open
3) Select Recovery Tab
4) Select the Recovery Scenario which is assigned with the current test
5) Click on Properties button. Now you can see all the properties of a recovery scenario in non-editable format.

On what conditions the recovery scenarios can be activated in qtp
The recovery scenarios are activated based on the below mentioned instructions
1) On every step. The recovery mechanism is activated after every step.

2) On error. The recovery mechanism is activated only after steps that return an error return value.
3) Never. The recovery mechanism is disabled
How to add an existing recovery scenario to the test script in qtp

An existing recovery scenario is added to the test script by following the below mentioned steps.

1) Choose File -> Settings. Test Settings Dialog Box will open
2) Select Recovery Tab
3) Click on the Add button. Add Recovery Scenario dialog box opens
4) Click on Open Attachment button. Open Attachment dialog box opens
5) Choose the already created recovery file (.qrs file) and click on open button
6) Click Add Scenario button in Add Recovery Scenario dialog box
7) Click on OK button on Test Settings Dialog Box

How to edit an existing recovery scenario in qtp

The Recovery Scenarios are edited by following the steps mentioned below.


1) Open the Recovery Scenario. Choose Resources -> Recovery Scenario Manager ... Recovery Scenario Manager Dialog box opens
2) Click on Open button. Open Attachment Dialog box opens
3) Choose the Recovery Scenario (.qrs file) file. Click on Open button
4) Follow the Recovery Scenario Wizard to edit the Recovery Scenario

Tuesday, February 19, 2013

Run DOS commands from QTP

    Dim oshell
    Set oshell=createobject("WScript.shell")
    oshell.Run "cmd /k ipconfig"
    Set oshell=nothing

Tuesday, February 5, 2013

QTP- Some Basic Questions


Type of Objects available in QTP

There are 4 types of Objects available in QTP.

1) Run-time Objects- it present under Application under Test (AUT) is called run time object. State can be Enable, disable,focused
2) Test Objects-Reference of run time object is called Test object
3) Utility Objects
4) Automation / User Defined Objects- user defined objects used to work with files, drives, folder etc. example FileSystemObject, ExcelObject, Database connection object etc

Utility Objects

These are QTP reserved objects, used for Testing and Result reporting.
Example:

a) SystemUtil
b) Reporter
c) DataTable
d) Services
e) environment etc...

About Object, Property and value

Object: It is something which has structure and properties
Property: an attribute of an Object.
Value: Value of the Property

About Statement, Action and Test in QTP

Statement: an Instruction or a minimal executable unit
Action: Set of Statements
Test: One or more Actions

How Load repository files During run-time?

We can Load Object Repositories during run-time using an Utility object called "RepositoriesCollection"
Syntax:
RepositoriesCollection.Add "path of the Repository file"

Example:
RepositoriesCollection.Add "D:\ORsample.tsr"