Monday, April 11, 2011

QTP Sample Questions

1. What does ChildObject Method Return
a. A Collection Object
b. A string true/false
c. A Boolean True/False
d. The Number of objects matching the child object descriptions
Ans: a

2. How can you make a test bypass the Object Repository during Test Run.
a. Turn the Object Repository Off
b. Use a programmatic Description
c. Delete all objects in all repositories
d. Add the Object in Object Repository Manager
Ans: b

3. When a test is run in Update mode, what options can you select? Select Three
a. the datatable
b. Check point properties
c. Test Object Description
d. Action Names in the test
e. Logical Names in the test
f. Active Screen Images and Values

4. What Object is used to read information from text file
a. Read
b. ReadLine
c. TextStream
d. FileStream
e. OpenTextFile

5. What can you use to handle unpredictable exceptions
a. A Do Loop
b. Recovery Scenario
c. If Then Else
d. Select Case Statemtn
Ans: b

6. You have just stopped recording steps into your tests. Your application under step is still up and visible on your screen. You now wish to add checkpoints into your test using the menu command, insert > Checkpoint from the toolbar. Which checkboxes are available to you? Select two
a. Text checkpoint
b. XML checkpoint
c. Bitmap checkpoint
d. TextArea checkpoint

7. Browser Navigation Timeout is in which tab of Test Settings
a. Properties
b. Resources
c. Web
d. Web Settings
Ans: c

8. How many tabs are present in Test Settings (File > Settings) window
a. 7
b. 6
c. 5
d. 8
Ans: a

9. Identify the Tabs in the Test Settings (File > Settings) Window
a. Properties, Run, Resources, Parameters, Environment, Web, Recovery
b. Properties, Run, Resources, Parameters, Environment, Web Settings, Recovery
c. Properties, Run, Options, Parameters, Environment, Web, Recovery
d. Properties, Run, Resources, Input Parameters, Environment, Web, Recovery
Ans: a

10.'Generate Script' is in which tab of Test Settings (File > Settings) window
a. Properties
b. Web
c. Resources
d. Recovery
Ans: a

11. The following are the main columns in the Keyword view
a. Item, Operation, Value, Comments
b. Item, Operation, Value, Documentation
c. Item, Operation, Property, Documentation
d. Number, Operation, Value, Documentation
Ans: b

12. For each object and method in an Expert view statement, a corresponding row exists in the Keyword view
a. True
b. False
c. There is a problem with the statement
d. None of the above
Ans: a

13. You can work with one or several function libraries at the same time
a. True
b. False
Ans: a

14. You can insert additional steps on the test objects captured in the Active Screen after the recording session
a. True
b. False
Ans: a

15. Active screen enables you to parameterize object values and insert checkpoints
a. True
b. False
Ans: a

16. A QTP user can increase or decrease the active screen information saved with the test.
a. True
b. False
Ans: a

17. The information pane provides a list of .... in the test.
a. Semantic error
b. Syntax error
c. Common errors
d. Logical errors
Ans: b

18. When we switch from Expert view to Keyword view, QTP automatically checks for syntax errors and shows them in the information pane.
a. True
b. False
Ans: a

19. If the information pane is not open, QTP automatically opens it incase a syntax error is detected
a. True
b. False
Ans: a

Friday, November 12, 2010

Recovery Scenario Manager

Unexpected events, errors and application crashes during a run session can disrupt your run session and distort results. This is a problem particularly when tests run unattended - the test pauses until you perform the operation needed to recover. To handle such situation, QTP enables you to create recovery scenarios and associate them with specific tests.

If you can predict that a certain event may happen at a specific point in your test, it is highly recommended to handle that event directly within your test by adding steps such as if statements or optional steps, rather than depending on a recovery scenario. By default, recovery scenario operation are activated only after a step returns an error.

Creating a Recovery Scenario File

Go to Resources > Recovery Scenario Manager.



Click on New Scenario Button



Click on Next. Select Trigger Event Dialog Box opens.



This screen displayed in the wizard depends on which of the following trigger types you select.
1. Popup Window
2. Object State
3. Test Run Error
4. Application Crash



Using this option (Window title and/or Window text) instructs QTP to identify any pop-up window that contains the relevant title and/or text. Click on Hand button and show the popup window which is popup.

Click on Next Button.



Using this we can select an object for which we have to create recovery. Click on Hand button and show the object

Click on Next Button



Select the type of error for which you want to create recovery and click on Next.



Running process displays all application processes that are currenly running. The processes list displays the application processes that will trigger the recovery scenario if they crash.

Click on Next Button to the Recovery operations Screen and again click on next for recovery operations.


Select the type of recovery operation and click on next.
Keyboard or mouse operation
QTP simulates a click on a button in a window or a press of a keyboard key. Select this option and click on Next to continue to the Recovery Operation.

Close application process
QTP closes specified processes. Select this option and click on Next to continue to the Recovery Operation - Close Processes Screen.

Function call
QTP calls a VBScript function. Select this option and click Next to continue to the Recovery Operation - Function Call Screen.

Restart Microsoft Windows
QTP restarts Microsfot Windows. Select this option and click Next to continue to the Recovery Operations Screen.



If you select function call then this screen will be displayed. By clicking on browse button select the recovery function, if it already available. Else Select Define new function to define now.

Click on Next for Post Recovery Operations.



Post Recovery Operations
Repeat current step and continue: Repeat the current step that QTP was currently running when recovery scenario is triggered.
Proceed to next step This skips the step that QTP was running when the recovery scenario was triggered
Proceed to next step or component Goes to next action iteration after completion of recovery operation
Proceed to next test iteration Goes to next test iteration after completion of recovery operation
Restart current test run To restart the testrun after completion of recovery operation
Stop the test run To Stop the Entire Test run.



Enter a name and a textual description for your recovery scenario, and click Next to continue to the completing the Recovery Scenario Wizard Screen.



In the Completing the Recovery Scenario Wizard screen, you can review a summary of the scenario settings you defined. You can also specify whether to automatically associate the recovery scenario with the current test and/or to add it to the default settings for all new tests.

Click on Finish, save the scenario and Scenario File. If you want to use this scenario for any test you need to associate the scenario to a test.

Output Values

QTP enables you to retrieve values in your test and store them as output values in datatable or in environment variables. An output value is a step in which one or more values are captured at a specific point in your test and stored for the duration of the run session. The values can later be used as input at a different point in the run session.

You can output the property values of any object. You can also output values from text strings, table cells, databases and XML Documents.

Wednesday, November 10, 2010

Recording QTP Scripts

To select the application to record, select Automation > Record

Information Pane

Information Pane provides a list of syntax errors in your test or function library scripts.

To show or hide information pane, choose View > Information Pane

When you switch from the Expert View to the Keyword View, QuickTest automatically checks for syntax errors in your script, and shows them in the Information pane.

Thursday, November 4, 2010

Object Identification

This concept tells how QTP is identifies while running and recording session.

Object Identification in Running session

In Normal or Low level recording QTP stores object information in the object repository. QTP script consists of the object class, object name, operations, and values.

While Running the scripts QTP will see the class, object name in the script and it searches the same object name in the object repository. If that name exists in the object repository then QTP will identify the object in the application using recorded properties in the object repository.

To change the object identification in QTP, select
Tools > Object Identification

Using Object Identification, you can
1. Configure the properties for each class
2. Selecting the Ordinal Identifier
3. Configure the smart identification
4. Creating user defined classes

In object Identification Dialog box you can find list of classes. For every class you can find pre-configured Mandatory and assistive properties.



  1. Mandatory properties -- Properties that QTP always learns for a particular test object classes.

  2. Assistive properties --- Properties that QTP learns only if the mandatory properties are sufficient to create a unique description. If several assistive properties are defined for an object class, then QTP learns one assistive property at a time and stops as soon as it creates a unique description for the object.

  3. Ordinal Identifier--- If the combination of all defined mandatory and assistive properties is not sufficient to create a unique test object description, Quick Test also records the value for the selected ordinal identifier.

There are two types of ordinal identifiers:



  • Index - indicates the order in which the object appears in the application code relative to other objects with an otherwise identical description.

  • Location - Indicates teh order in which the object appears within the parent window, frame, or dialog box relative to other objects with an otherwise identical description. Values are assigned from top to bottom, and then left to right.

  • Web Browser object has the third ordinal identifier type:
    CreateTime - Indicates the order in which the browser was opened relative to other open browsers with an otherwise identical description. Each test object class has a default ordinal identifier selected.



Using QTP

To get the property of an object using QTP "GetToProperty" method