Tuesday, 21 April 2015

QTP-Interview Questions:

 Q. 1: 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. 2: What is a Recovery Scenario?
============================
Recovery scenario gives you an option to take some action for recovering from a fatal error in the test. Such problems are quite frequent especially when the tests are made to run unattended. In such a case the test process halts until the user perform some desired recovery operation.
Recovery scenarios are useful when it is difficult to predict at which step the errors can come or when we are confident that the error will not come in the QTP script, whereas it can be anywhere outside the QTP Script. For illustration; Pop-up message of "out of paper", as caused by the printer device driver. "On error resume next" is preferred when we sure that the error is expected one and wish to perform some other actions.
=================================
Q. 3: What is Smart Identification in QTP?
=================================
QTP has a unique feature by the name Smart Object Identification or recognition which is used for identifying the objects smartly, whenever the normal identification fails due to the dynamic changes in the properties of the objects.
Smart Identification is nothing but an algorithm used by the QTP when it is not able to recognize an object.
=================================
Q. 4: How QTP identifies various Objects?
=================================
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. 5: 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. 6: 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. 7: 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. 8: 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.
You can open the Step Generator from the Keyword View or Expert View while recording or editing your test. You 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. 9: 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. 10: What is the Object Spy feature in QTP?
====================================
Using the Object Spy pointing hand mechanism, you can view the supported properties and methods of any object in an open application. As you move the pointing hand over the objects in the application, their details are displayed in the Object Spy. These details may include the test object's hierarchy tree, its properties and values, and the methods associated with the object. For methods, the syntax is also displayed.

Q. 11: 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. 12: 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. 13: 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. 14: What is a Checkpoint?
=======================
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. 15: 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. 16: 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. 17: What's the difference between a Checkpoint and Output Value?
=================================================
Checkpoint only checks for the specific attribute of an object in AUT while Output value can output those attributes value to a column in data table.
==================================================
Q. 18: How can we Disable Smart Identification During the Run Session?
==================================================
Selection of the option "Disable Smart Identification during the run session", Instructs QTP not to use the Smart Identification mechanism during the run session.
When we select this option, the Enable Smart Identification check boxes in the Object Properties and Object Repository dialog boxes get disabled, although the settings are saved. However when you clear this option, the Enable Smart Identification check boxes return to their previous on or off setting.
=====================================================
Q. 19: What are the Properties used by Smart Identification Feature of QTP?
=====================================================
1) 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.
2) 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. 20: How can we check if an environment variable exists or not?
====================================================
When we use Environment("Param1").value then QTP expects the environment variable to be already defined. But when we use Environment.value("Param1") then QTP will create a new internal environment variable if it does not exists already. So to be sure that variable exist in the environment try using Environment("Param1").value.

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.