Monday, February 23, 2009

QTP Q&A



1.Explain in brief about the QTP automation object model

The test object model is a large set of object types or classes that QTP uses to represent the objects in our application. Each test object has a list of properties that can uniquely identify objects of that class

2.What is a Run-Time data table?

The test results tree also includes the table-shaped icon that displays the run-time data table-a table that shows the values used to run a test containing data table parameters or the data table output values retrieved from a application under test

3.What are all the components of QTP test script?

QTP test script is a combination of VB script statements and statements that use QuickTest test objects ,methods and properties

4. What is test object?

Its an object that QTP uses to represent an object in our application. Each test object has one or more methods and properties that we can use to perform operations and retrieve values for that object. Each object also has a number of identification properties that can describe the object.

5.What are all the rules and guidelines want to be followed while working in expert view?

Case-sensitivity:
VB script is not case sensitive and does not differentiate between upper case and lower case spelling of words.
Text strings:
When we enter value as a string, that time we must add quotation marks before and after the string
Variables:
We can use variables to store strings,integers,arrays and objects. Using variables helps to make our script more readable and flexible.
Parentheses:
To achieve the desired result and to avoid the errors,it is important that we use parentheses() correctly in our statements.
Comments:
We can add comments to our statements using apostrophe(’),either at a beginning of the separate line or at the end of a statement
Spaces:
We can add extra blank spaces to our script to improve clarity. These spaces are ignored by the VB script

6. Mention the types of recording available in QTP?

QTP provides three types of recording methods:

* Context Recording (Normal)
* Analog Recording
* Low Level Recording

7. What are the different scripting languages you could use when working with QTP ?

You can write your QTP automation programs in any Languages and development environment that supports automation. For example: you can use: VBScript,javaScript,Visual Basic,Visual C++, or Visual Studioi.Net

8. What is the file extension of the code file & object repository file in QTP?

Extension of code file in QTP is - .mts Local Object Repository Extension is - .mtr Shared Object Repository Extension Is - .tsr

9. How to handle the exceptions using recovery secnario manager in Qtp?

You can instruct QTP to recover unexpected events or errors that occured in your testing environment during test run.Recovery scenario manager provides a wizard that guides you through the defining recovery scenario. Recovery scenario has three steps

1. Triggered Events
2. Recovery steps
3. Post Recovery Test-Run

10. What is Parameterizing Tests?

When you test your application, you may want to check how it performs the same operations with multiple sets of data. For example, suppose you want to check how your application responds to ten separate sets of data. You could record ten separate tests, each with its own set of data. Alternatively, you can create a parameterized test that runs ten times: each time the test runs, it uses a different set of data.

11. Explain the check points in QTP?

A checkpoint verifies that expected information is displayed in a Application while the test is running. You can add eight types of checkpoints to your test for standard web objects using QTP.

• A page checkpoint checks the characteristics of a Application
• A text checkpoint checks that a text string is displayed in the appropriate place on a Application.
• An object checkpoint (Standard) checks the values of an object on a Application.
• An image checkpoint checks the values of an image on a Application.
• A table checkpoint checks information within a table on a Application
• An Accessiblity checkpoint checks the web page for Section 508 compliance.
• An XML checkpoint checks the contents of individual XML data files or XML documents that are part of your Web application.
• A database checkpoint checks the contents of databases accessed by your web site

12. Explain the concept of how QTP identifies object.?

During recording qtp looks at the object and stores it as test object.For each test object QT learns a set of default properties called mandatory properties,and look at the rest of the objects to check whether this properties are enough to uniquely identify the object. During test run,QT searches for the run time obkects that matches with the test object it learned while recording.

13. Explain QTP Testing process?

The QuickTest testing process consists of 7 main phases:


1.Preparing to record Before you record a test, confirm that your application and QuickTest are set to match the needs of your test. Make sure your application displays elements on which you want to record, such as a toolbar or a special window pane,

for example, and that your application options are set as you expect for the purposes of your test. You should also view the settings in the Test Settings dialog box (Test > Settings) and the Options dialog box (Tools > Options) to ensure that QuickTest will record and store information appropriately.

For example, you should confirm that the test is set to use the appropriate object repository mode.

2.Recording a session on your application As you navigate through your application or Web site, QuickTest graphically displays each step you perform as a row in the Keyword View. A step is any user action that causes or makes a change in your application, such as clicking a link or image, or entering data in a form.

3.Enhancing your test Inserting checkpoints into your test lets you search for a specific value of a page, object, or text string, which helps you determine whether your application or site is functioning correctly.

4.Broadening the scope of your test, by replacing fixed values with parameters, lets you check how your application performs the same operations with multiple sets of data.

5.Adding logic and conditional or loop statements enables you to add sophisticated checks to your test.

6.Debugging your test You debug a test to ensure that it operates smoothly and without interruption.

7.Running your test You run a test to check the behavior of your application or Web site. While running, QuickTest opens the application, or connects to the Web site, and performs each step in your test.

8.Analyzing the test results You examine the test results to pinpoint defects in your application.

9.Reporting defects If you have Quality Center installed, you can report the defects you discover to a database. Quality Center is Mercury Interactive's software test management tool.

14. What is the use of Recovery Scenario Manager in QTP?

The Recovery Scenario Manager provides a wizard that guides you through the process of defining a recovery scenario—a definition of an unexpected event and the operation(s) necessary to recover the run session. For example, you can instruct QuickTest to detect a Printer out of paper message and recover the run session by clicking the OK button to close the message and continue the test or component.

15. What is the use of Text output value in Qtp?

Output values enable to view the values that the application talkes during run time.When paramaterised, the values change for each iteration.Thus by creating output values, we can capture the values that the application takes for each run and output them to the data table.

QTP FAQ



1. How to create basic scripts from a manual test case in QTP?
2. How to add verification steps to tests?
3. How to use custom checkpoints in QuickTest Professional?
4. How to use database checkpoints?
5. How to manage objects in the Object Repository in QuickTest Professional?
6. How to parameterize tests?
7. How to customize checkpoints with parameters?
8. How to run an integrated test scenario using Multiple Actions?
9. How to use the QTP Step Generator?
10. How to use debug tools?
11. How to create virtual objects?
12. What is the difference between QTP Analog and Low-Level recording modes?
13. Please describe Object and Smart Identification?
14. What is the difference between Per-Action vs. Shared Object Repositories?
15. What are the main benefits of QuickTest Professional?
16. What is Add-In Manager in QTP?
17. What QTP Options do you know?
18. How to Identify Objects and their Properties?
19. What is the Object Repository?
20. How to Add Synchronization Steps?
21. How to Set the Global Sync Timeouts in QTP?
22. What is Regular Expressions and how to use them?
23. How to Create Data-Driven tests?
24. What are Checkpoints with Parameters?
25. What is the difference between Global and Local Data Sheets?
26. How to create Reusable and Multiple Actions?
27. Describe the benefits of the Step Generator.
28. What are the main options that are available in the Step Generator dialog box?
29. What is Exception Handling?
30. What is Recovery Scenario Wizard in QTP?
31. Describe the purpose of a Database Checkpoint
32. What is the difference between Analog Recording and Low-Level Recording in automation tools?
33. Describe Per-Action vs. Shared Object Repositories
34. Describe how and when Smart Identification is used

Friday, February 6, 2009



Resolving object conflicts:

Conflicts between objects in the primary and secondary object repositories are resolved automatically by the Object Repository Merge Tool using default resolution settings. For information on defining the default settings, refer to the QuickTest Professional User’s Guide (Help -> QuickTest Professional Help -> QuickTest Professional User’s Guide -> Managing and Merging Object Repositories -> Merging Shared Object Repositories -> Defining Default Settings).

The Object Repository Merge Tool also allows you to change the way the merge was performed for each individual object that causes a conflict.
1. In the object repository tree, select an object that has a conflict (there will be an icon to the left of the object name). The conflicting objects are highlighted in the source repositories. A description of the conflict and the resolution method used by the Object Repository Merge Tool is described in the Resolution Options pane.
2. In the Resolution Options pane, select a radio button to choose a resolution method. The target object repository is updated according to your selection and redisplayed.

Note:
The resolution method the Merge Tool used is selected by default.

3. Click or to jump directly to the next or previous conflict in the target object repository hierarchy.
4. Repeat steps 1 through 3, as needed.
5. Save the merged object repository file

Merging shared object repositories:

1. Open the Object Repository Manager.
2. Go to Tools -> Object Repository Merge Tool.
3. In the New Merge window, browse to the primary repository file. Mercury recommends selecting the repository file you have invested the most time into as the primary repository file.
4. Select the secondary repository file.
5. Click .
6. Review the merge statistics, as described in Viewing Merge Statistics, and click .
7. Resolve any merge conflicts that were reported.

Merging a local object repository with a shared object repository:

To merge the contents of a local repository into a shared repository, the shared repository must be associated with the action containing the local repository. In the Object Repository Manager, select the “Update from Local Repository” option.
Updating the Shared Object Repository with the objects in the Local Repository will merge all objects from the Local Repository into the Shared Repository. All objects will be removed from the Local Repository.

1. Save the script containing the Local Repository. Open a new test.
2. Go to Resources -> Object Repository Manager.
3. In the Object Repository Manager window, go to File -> Open, and select the Shared Object Repository file. Clear the “Open in read-only mode” checkbox.
4. If the repository file opened in read-only mode, go to File -> Enable Editing.
5. Go to Tools -> Update from Local Repository.
6. Click the “Add Tests” icon button. If you are connected to a TestDirector for Quality Center with Business Process Testing, you will have the option to browse for a test or a component. Select the appropriate choice.
7. Navigate to the test or component containing the Local Repository.

Note:
You can only add a test containing actions that are associated with the Shared Object Repository you are updating and whose Local Object Repositories contain objects.

8. In the Update from Local Repository dialog, select the desired action.
9. Repeat steps 6 through 8 as needed.
10. Click .

Note:
If the test using the Shared and Local Repositories is currently open, you may receive an error similar to the following:
“You cannot update this shared object repository from the test’s local object repository because the test is currently locked by ‘ on machine ‘’. Wait for the test to be unlocked and then try to perform the update operation for this test again.
If so, open a new test in QuickTest Professional to release (unlock) the test and repeat step 10.

11. Perform any steps needed to resolve conflicts.
12. If you are performing multiple merges, go to File -> Save and Merge Next to perform the next merge (the Local Object Repository of the next action being merged into the Shared Object Repository).
13. Click to save your changes between merges. If you click , the current merge (objects merged from the last action) will not be saved.
14. Repeat steps 11 through 13 to complete the multiple merges.
15. Choose File -> Exit, then click to save the updated Object Repository.

Adding objects to a shared object repository:

An object can be added to a shared object repository in one of the following ways:

1. From a local repository.

2. Add objects manually.
• Go to Resources -> Object Repository Manager.
• Go to File -> Open -> .
• By default the repository will open in read-only mode. Go to File -> Enable Editing.
• Go to Object -> Add Objects.
• Click on the object to be added to the repository.
• If the Object Selection window appears, select the desired object, and click .
• If the Add Object to Object Repository window appears, select the appropriate option:
• To add only the selected object, select the “Only the selected object” radio button. To add the selected object and its child objects of a specified type, select the “Selected object and its descendants of type” radio button. Then, select the checkbox next to the child object types that should be added.
• Click .

3. Manually define a new test object.
• Go to Resources -> Object Repository Manager.
• Go to File -> Open -> .
• By default the repository will open in read-only mode. Go to File -> Enable Editing.
• Go to Object -> Define New Test Object.
• Select the appropriate Environment for your test object. For example, to add a Link object, select “Web.”
• Select the desired test object class for the new object.
• Enter a name for your test object.
• Fill in the Test object details as needed. The Test object details area automatically contains the mandatory properties defined for the object class in the Object Identification dialog box. You can add or remove properties as required, and define values for the properties.
• To add properties, click the “Add description properties” button (with the + icon). Select the properties to be added and click .
To remove properties, select the properties to be removed and click the “Remove selected description properties” button (with the X icon)
• Click to add the new object.
• Repeat steps d through h as needed.
• When done, click .

Note:
When you manually define an object, QuickTest Professional will not automatically add the object’s parent. If the parent objects are not present, you will need to define them as well. Once the objects are added to the repository, you can drag and drop them to their appropriate positions.

4. Merge with another shared object repository.

Adding objects to a local object repository:

An object can be added to the local object repository in one of the following ways:

1. Record some actions on the object; this will automatically add this object to the object repository. If you do not need the recorded statements in your script, you can delete them and it will not remove the added object from the object repository.

2. Add objects manually.
• Go to Resources -> Object Repository.
• In the Filter combo box, select “Local Objects.”
• Go to Object -> Add Objects to Local.
• Click on the object to be added to the repository.
• If the Object Selection window appears, select the desired object, and click .
• If the Add Object to Object Repository window appears, select the appropriate option:
• To add only the selected object, select the “Only the selected object” radio button. To add the selected object and its child objects of a specified type, select the “Selected object and its descendants of type” radio button. Then, select the checkbox next to the child object types that should be added.
• Click .

3. Manually define a new test object.
• Go to Resources -> Object Repository.
• In the Filter combo box, select “Local Objects.”
• Go to Object -> Define New Test Object.
• Select the appropriate Environment for your test object. For example, to add a Link object, select “Web.”
• Select the desired test object class for the new object.
• Enter a name for your test object.
• Fill in the Test object details as needed. The Test object details area automatically contains the mandatory properties defined for the object class in the Object Identification dialog box. You can add or remove properties as required, and define values for the properties.
• To add properties, click the “Add description properties” button (with the + icon). Select the properties to be added and click .
To remove properties, select the properties to be removed, and click the “Remove selected description properties” button (with the X icon)
• Click to add the new object.
• Repeat steps d through h as needed.
• When done, click .

Note:
When you manually define an object, Quick Test Professional will not automatically add the object’s parent. If the parent objects are not present, you will need to define them as well. Once the objects are added to the repository, you can drag-and-drop them to their appropriate positions.

4. Add the object using the Active Screen.
• In the Active Screen, right-click on the object to be added.
• Select “View/Add Object.”
• If the Object Selection window appears, verify the desired object is
selected, and click .
• In the Object Properties window, click .

Object Repository - QTP

Overview of Object Repository:

QTP Object Repository displays a tree of all objects in the current component or in the current action or entire test (depending on the object repository mode you selected).

We can view or modify the test object description of any test object in the repository or to add new objects to the repository.

QuickTest learns the default property values and determines in which test object class it fits. If it is not enough it adds assistive properties, one by one to the description until it has compiled the unique description. If no assistive properties are available, then it adds a special Ordinal identifier such as objects location on the page or in the source code.

QuickTest has two types of object repositories for storing object information: shared object repositories and action object repositories. You can choose which type of object repository you want to use as the default type for new tests, and you can change the default as necessary for each new test.

The object repository per-action mode is the default setting. In this mode, QuickTest automatically creates an object repository file for each action in your test so that you can create and run tests without creating, choosing, or modifying object repository files. However, if you do modify values in an action object repository, your changes do not have any effect on other actions. Therefore, if the same test object exists in more than one action and you modify an object's property values in one action, you may need to make the same change in every action (and any test) containing the object.

For any automation tool that follows OO concept the object repository forms the basis of automation frame-work. It is indeed important to make a choice between Shared & script specific (Action specific) object repository. For a web based application, it is not possible to have a shared object repository as too many objects in one .mdb file could lead to commotion especially when we have a team of automation testers. Thus, automation testers should be assigned partition specific responsibility in maintaining the object repository and updating it as when required. Further, QTP 9.0 has a wonderful drag & drop feature in creating object repository. Thus both shared as well as action specific can be maintained.
Now comes the golden question - Is it possible to create OR without using RECORD feature of QTP. Well, the answer is YES. Descriptive Programming is the best way of doing it. But for doing so the business documents should have UI mock-ups that have been reviewed and sign-off by the business experts. These mock-ups would then give the tester an idea about the various objects and their respective classes. The automation tester should than create his own repository using the describe method. But this is again time-consuming. Try avoiding descriptive programming to create OR. However, DP is the only the best option when the DEV team are developing the APP using customized objects; as a result of which QTP cannot recognize these objects. HTCs are the best example of customization. The best work-around is treating these customized objects as combination of objects and creating scripts accordingly. This is too much of trial & error method.

Once the OR is ready, then it should be maintained using QC or TD. However, during script execution the run-time is affected, but at the cost of having well-maintained OR.