QTP VBScript new series + Interview Question Bank on QTP for enrichment of Knowledge in QTP

This Site has been brought to you by HP Certified Expert of QTP.

Exciting new articles for October:

1) QTP Tip:Deselect all Radio Buttons

2) HP QTP Crypt Object

3)Adding Hyperlinks in Excel Spreadsheet

Best of Luck Friends ! ! !

Expert QTP

All Articles are Copyright Protected. These are Free for Reading & Personal Use. Reproduction in Any Form without the Permission is Illegal & Strictly Prohibited.

Copyright © 2009 ExpertQTP

Google Search

Friday, August 8, 2008

Frequently Asked Interview Questions on QTP

Following Frequently Asked Questions shall be quite helpful in making a reasonably good foundation for attending an interview on QTP.

Q 1. What are the salient features of QTP?
# It is an automated functional Graphical User Interface testing tool.

# It can easily handle "Non-UI" based Test Cases as well. Like API (Certification testing & Database Testing etc.

# It is meant for automation of user actions on a web or client based computer application.

# It is primarily used for functional regression test automation. # It uses a scripting language based on VBScript

# It has an excellent error handling mechanism.# It has excellent data driven testing features.

Q 2. What is Recovery in QTP?
Exception handling is called Recovery in QTP. Its primary aim is to enable the tests to continue to run in case of an occurrence of an unexpected failure. For example if an application crash occurs and a message dialog appears, QTP can be instructed to attempt to restart the application and continue with the rest of the test cases from there onwards.

Q 3. What is a Checkpoint in QTP?
In QTP, Checkpoint is used to verify the application under test. It can introduce a checkpoint to verify as to whether a particular object, text or a bitmap is present in the automation run.

During a test execution, a checkpoint verifies that the behavior or state of the actual application is consistent with the expected application or not.

Q 4. How many types of checkpoints are available in QTP?
1) Standard Checkpoint - for checking the properties of an object.

2) Table Checkpoint – for checking the properties of a table.

3) Image Checkpoint – for checking the properties of an image.

4) Bitmap Checkpoint – for comparing an area of the application under test pixel-by-pixel with the screen as seen at record-time.

5) Database Checkpoint for automating the back-end testing.

6) Text Checkpoint – for checking that a section of text is found between two other sections of text.

7) Text Area Checkpoint

8) Page Checkpoint
– for checking the properties of a web page.

9) Accessibility Checkpoint – for checking the accessibility of an application.

10) XML Checkpoint

Q 5. How many types of main views of a script are available in QTP?
QTP provides two main views of a script. These are

1) Keyword View: is the default test procedure interface of QTP & is most useful for the beginners. It displays the automation steps of a test procedure as a descriptive tree of Actions and functions. The tree contains columns listing the Action or function name, any parameters, and comments.

2) Expert View: is most suitable for the advanced users, enabling them to customize the test, like writing user-defined functions. It is meant for displaying and editing of the source code of the test. Except for the root Global action, all other test actions can be edited here. Expert View acts as an IDE for the test. It includes most standard IDE features, such as breakpoints.

Both Keyword View & the Expert View can be selected from tabs available at the bottom of the QTP window.

Q 6. How results are generated in QTP?
At the end of the test, QTP generates a result file for the test cases, which is in the form of a XML tree.

This results file provides detail regarding ‘Pass’ or ‘Fail’ counts, error messages, and all supporting information which allows the user to diagnose the main cause of a failure.

Q 7. What is a Virtual Object in QTP?
Since sometimes complex objects are not recognized & recorded properly by QTP. Hence an experienced user can define that object as a personal virtual object and build a virtual object repository. This way by the concept of Virtual Object, the user can add some sort of support for such complex objects.

If it is possible to extract the desired information from the object, we can do successful record and playback against that object.

Q 8. How can we handle the exceptions with the help of recovery scenario manager in QTP?
With the help of recovery scenario manager we can recover from unexpected events or errors occurring in the testing environment during the test run. The Recovery Scenario Manager presents a structured wizard which helps us in defining the recovery scenario, like detailed definition of the unexpected event and the operations required to recover from the exception during the run session.

Recovery scenario has three steps in handling an exception
a) Triggered Events:
Is an unexpected event like appearance of a Pop-up window, object state, test run error causing application crash or interruption in our running session.

b) Recovery steps: are a series of steps required to be performed to enable QTP to proceed further with the process of test after some trigger event has interrupted the run session.

c) Post Recovery Test-Run: Are a set of instructions designed to be provided to QTP on proceeding further with the test after some recovery operation has been carried out.

Q 9. What is the use of Text output value in QTP?
Text Output values enable us to view the values which are taken by the application during the run time. If parameterized, the values change for every iteration. Hence by creating output values, we can capture the values which are taken by the application during the run time and output them to the data table.

Q 10. What is the Object Spy feature in QTP?
Object Spy enables us to view both the run-time object methods and the test, object methods associated with an object and to view the syntax for a selected method. It is used as a pointer to point towards an object. It displays the object hierarchy tree and the run-time object methods or test object methods associated with the selected object in the Methods tab of the Object Spy dialog box.

Q 11. What is Automation Object Model in QTP?
Like we use QTP for automating the testing of our applications, we can use the automation object model of QTP to automate its own operations as well. With the help of objects, methods, and properties exposed by the automation object model of QTP along with standard programming elements like loops and conditional statements, we can write programs which can configure QTP options and run tests or components instead of performing these operations manually using the QTP interface.

Automation programs are especially useful for performing the same tasks several times or on multiple tests or components, or quickly configuring QTP according to the needs for a particular environment or application.

Most of the dialog boxes in QTP have a corresponding automation object. Most of the options in dialog boxes can be set retrieved using the corresponding object property, and most of the menu commands and other operations have corresponding automation methods.

Q 12. What is a Run-Time Data Table in QTP?
During the run session, QTP creates a Runtime Data Table, which is live version of the Data Table associated with our test. During the run session, QTP displays the run-time data in the Data Table pane so that we can see the changes taking place in the Data Table.

When the run session ends, the Runtime Data Table closes, and the Data Table pane again displays the stored design-time Data Table. Data entered in the run-time Data Table during the run session does not get saved along with the test. The final data from the run-time Data Table gets displayed in the Run-Time Data Table in the Test Results window.

Runtime Data Table is an excel file, which gets stored in the folder of the test created, its name is Default.xls by default.

Q 13. What are the properties used by the Smart Identification mechanism?
The Smart Identification mechanism uses two types of properties:

a) Base filter properties: Are the most fundamental properties of a particular test object class. Her we can not change their values without changing the essence of the original object.

b) Optional filter properties: Are other properties, which help us in identifying the objects of a particular class since these are not likely to get changed frequently. These properties can be ignored in case these are not applicable any more.

Q 14. How many scripting languages can be used in QTP?
Scripts can be written using languages like Visual Basic, XML, JavaScript, Java, HTML

Q 15. What are the Commonly used Excel VBA functions.
Common functions are:
a) Coloring of a cell
b) Auto fit cell
c) Setting navigation from link in one cell to other

Q 16. How QTP identifies various object?
During recording QTP identifies various objects and stores them as test objects. For each test object QTP learns a set of default properties called mandatory properties. Simultaneously QTP looks at rest of the objects to check whether these properties are sufficient to uniquely identify the object or not. During the test run, QTP searches for the run time objects, which match with the test objects which, have been captured by it during recording.

Q 17. What are object repositories in QTP?
When planning and creation of tests is done, we firstly consider how we would like to store the objects in our tests. In QTP, the test objects can be stored in two types of object repositories

a) Shared object repository: It stores test objects in a file that can be accessed by multiple tests (in read-only mode). If someone is new to QTP, he can prefer to use local object repositories. This way he can record and run the tests without creating, choosing, or modifying shared object repositories because all objects are automatically getting saved in a local object repository which can be accessed by its corresponding action.

b) Local object repository: It stores objects in a file that is associated with one specific action, so that only that action can access the stored objects. If someone is familiar with QTP testing, he can find that it is quite efficient to save the objects in a shared object repository. This way, he can use the same shared object repository for multiple actions - if the actions include the same objects. Test object information that applies to many actions is kept in one centralized location. When the objects in the application change, we can update them in one location for all the actions that use this shared object repository.

Q 18. How QTP recognizes objects in object repositories?
Object Repository displays a tree of all the objects in the current component or in the current action or in the entire test , depending on the object repository mode selected by the user. We can view or modify the test object description of any test object in the repository or to add new objects to the repository.

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

Q 19. Is there any built-in function for scripting in QTP?
QTP uses an in-built functionality called "Step Generator" to create scripts while appropriate steps are entered into it. Step Generator utility enables us to add steps by selecting from a range of context-sensitive options and entering the required values.

We can open the Step Generator from the Keyword View or Expert View while recording or editing our test. We can also open the Step Generator from the Active Screen while editing.

Method to open the Step Generator from a function library is as under
a) In the function library, click the location in which you want to insert the new step.

b) Choose Insert > Step Generator, or right-click and choose Step Generator. Alternatively, press F7.

Q 20. How many types of Actions are there in QTP?
QTP uses following three kinds of actions:
a) Non-reusable action - can be called only in the test with which it is stored, and can be called only once.

b) Reusable action - can be called multiple times by the test with which it is stored (the local test) as well as by other tests.

c) External action – is a reusable action which is stored with another test. External actions are read-only in the calling test, but we can choose to use a local, editable copy of the Data Table information for the external action.

By default, all new actions are non-reusable. We can mark every action created by us in the test as reusable or non-reusable.

Q 21. How can we parameterize property values in QTP?
Data Driver feature enables us to quickly parameterize several property values for the test objects, checkpoints, and method arguments containing the same constant value within a given action.

We can choose to replace all occurrences of a selected constant value with a parameter, in the same way that we can use a Find and Replace All operation instead of a step-by-step Find and Replace process. QTP can also show us each occurrence of the constant so that we can decide as to whether to parameterize the value or not.

Method to parameterize a value using the Data Driver is as under:
a) Display the action you want to parameterize.

b) Choose Tools > Data Driver.

Q 22. How can we modify the properties of test object in QTP?
We can modify an object by modifying any one of its property values or by changing the set of properties used to identify the particular object. This can be done for objects in the local object repository with the help of Object Repository window, and for objects in the shared object repository using the Object Repository Manager.

Method to modify an object property is as under:
a) Right-click the step containing the object that changed, and choose Object Properties or choose Edit > Step Properties > Object Properties from the menu bar.

b) The Object Properties dialog box opens and displays the properties QuickTest uses to identify the object.

c) Modify the properties and values as required.

d) Click OK to close the dialog box.

Q 23. How to retrieve the property of an object?
We can retrieve the property of an object by the use of "GetRoProperty".

Q 24. How to open or close any application during Scripting?
During a run session, we can use SystemUtil, object to open and close the applications and processes.The SystemUtil.Run statement gets automatically added to the test when we run an application from the Start menu or the Run dialog box while recording a test.E.g : SystemUtil.Run "Notepad.exe" SystemUtil.CloseDescendentProcesses ( Closes all the processes opened by QTP )

Q 25. Why use Regular Expressions?
Regular expressions are used to increase the flexibility and adaptability of the tests. Regular expressions enable QTP to identify objects and text strings with varying values.

Regular expressions can be used while defining the properties of an object, the methods of an argument, while parameterizing a step, and while creating checkpoints with varying values

Key Word: FAQ, Frequently Asked Question, QTP, Quicktest professional, Interview question


alisha said...

Really nice stuff man..

Anonymous said...

really helpful..thanks.

Copyright © 2009 ExpertQTP