http://quicktesthp.blogspot.com

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
expert.qtp@gmail.com

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

Saturday, September 27, 2008

QTP - Interview Question Bank : Part 3

Q. 21: Where can we use a Function or an Action? ========================================
It all depends on the scenario.

If you want to use the OR feature then you have to go for Action only. If the functionality is not about any automation script i.e. a function like getting a string between to specific characters, now this is something not specific to QTP and can be done on pure VB Script, so this should be done in a function and not an action. Code specific to QTP can also be put into an function using DP. Decision of using function/action depends on what any one would be comfortable using in a given situation.

===================================================
Q. 22: What is the difference between an Action and a Function? ===================================================
Action is a activity specific to QTP while functions are a generic thing which is a feature of VB Scripting. Action can have a object repository associated with it while a function can't. A function is just lines of code with some / none parameters and a single return value while an action can have more than one output parameters.

================================================
Q. 23: What are the various events available in the Recovery Scenario Manager? ================================================
1) Application Crash:
This event is useful in handling crashed applications at runtime.

2) Pop Up Window:
This event is useful in managing various unwanted application windows, which get built-up at runtime.

3) Test Run Error:
This event is useful in handling VBScript statement errors at runtime.

4) Object State:
This event is useful in handling object related errors at runtime.

=========================================
Q. 24: What are the Elements of Recovery Scenario?=========================================
Steps to handle the exceptions are
1) Trigger Event: 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.

2) Recovery Steps: Constitutes 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. Examples of a recovery operation can be 1) A keyboard or mouse Operation like a Click over the "OK" button in the Pop-up window 2) Close Application Process 3) Function Call 4) Restarting the OS etc.

3) 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. Examples of Post Recovery actions can be repeating the complete test from the beginning or some steps may be skipped altogether & continuing with the remaining steps in the test.

=====================================================
Q. 25: When to use a Recovery Scenario and When to use "on error resume next"?=====================================================
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. 26: What are the key features of QTP at a glance:
=========================================
# Ease of use:
QTP allows even novice testers to become productive in minutes. You can create a test script by simply pressing a Record button and using an application to perform a typical business process. Each step in the business process is automated documented with a plain-English sentence and screen shot. Users can easily modify, remove, or rearrange test steps in the Keyword View.

# Simple interface: QTP is much simpler to understand. It presents a test case as a simple business workflow to the tester.

# Simple Language: QTP uses Microsoft's VBScript for its test procedures, and to manipulate the objects and controls of the application under test. VBScript is a real programming language where several existing functions & resources are easily available for implementation these days.

# Use of zero-configuration Technology: QTP uses next-generation "zero-configuration" Keyword Driven testing technology. This helps in faster test creation, easier maintenance, and provides more powerful data-driving capability.

# Automatic insertion of checkpoints: QTP enables thorough validation of applications through a full complement of checkpoints. QTP can automatically introduce checkpoints to verify application properties and functionality, for example to validate output or check link validity.

# Marvelous interface with Data-tables: QTP allows entry of test data into the Data Table, an integrated spreadsheet with the full functionality of Excel, to manipulate data sets and create multiple test iterations, without programming, to expand test case coverage. Data can be typed in or imported from databases, spreadsheets, or text files. QTP has better and easier to use Data table integration compared to WinRunner.

# Better object identification mechanism: QTP Identifies objects with Unique Smart Object Recognition, even if objects change from build to build, thereby enabling reliable unattended script execution.

# Support of variety of environment: QTP supports functional testing of all popular environments, like Windows, Web, .Net, Visual Basic, ActiveX, Java, SAP, Siebel, Oracle, PeopleSoft, terminal emulators, and Web services.

# Easy adaptability of Microsoft Object Models: QTP can easily create and implement Microsoft Object Model like: Outlook objects, ADO objects, FileSystem objects, supports DOM, WSH, etc.

# Auto-documentation technology: QTP renders test documentation and test creation to a single step with the help of its auto-documentation technology

=================================================
Q. 27: What are various types of properties when using object identification in QTP?
=================================================
QTP uses three types of properties when identifying a object
1. Mandatory Properties - Always learn these properties for the object

2. Assistive Properties
- Learn in case Mandatory properties are not enough to identify the object uniquely

3. Ordinal identifiers
- Learn in case both mandatory and assistive properties are not able to recognize the objects correctly

=====================================================
Q. 28: What are the various ways to insert a Action in a test in QTP?=====================================================
There are three ways to insert a Action in a test
1. Insert Call to New…
2. Insert Call to Copy…
3. Insert Call to Existing…

========================================
Q. 29: What is the use of Parameterization in QTP?========================================
Parameterization is helpful in following aspects.# Parameterization allows us to pick different values at run time.
# Reduces Time and Effort.

# Usage of data drivers allows us to use the same data for various input boxes.

# Parameterization can also be done for checkpoints.

=============================
Q. 30: What are Data Tables in QTP?
=============================
Data Table is MS Excel like spreadsheet which can be used for parameterizing a test case
DataTable are of two types:
1. Global Data Table - Data table for Test flow

2. Local data table - Data table for every action


Keyword: QTP Interview Questions, FAQ QTP


Read more...


QTP - Interview Question Bank : Part 2

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.

Keyword: QTP Interview Questions, FAQ QTP


Read more...


QTP - Interview Question Bank : Part 1

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.

Keyword: QTP Interview Questions, FAQ QTP




Read more...


 
Copyright © 2009 ExpertQTP